PHPStan fixes

This commit is contained in:
Timothy Warren 2017-02-22 14:46:35 -05:00
parent 65227e82ac
commit adc331d60d
14 changed files with 51 additions and 18 deletions

View File

@ -36,14 +36,14 @@ class Auth {
/**
* Anime API Model
*
* @var \Aviat\AnimeClient\API\Kitsu\Model
* @var Model
*/
protected $model;
/**
* Session object
*
* @var Aura\Session\Segment
* @var \Aura\Session\Segment
*/
protected $segment;

View File

@ -73,7 +73,7 @@ class MAL {
'completed' => MangaReadingStatus::COMPLETED,
'onhold' => MangaReadingStatus::ON_HOLD,
'dropped' => MangaReadingStatus::DROPPED,
'plantoread' => MangaReadingStatus::PLAN_TO_WATCH
'plantoread' => MangaReadingStatus::PLAN_TO_READ
];
}
}

View File

@ -34,6 +34,11 @@ class Model {
* @var AnimeListTransformer
*/
protected $animeListTransformer;
/**
* @var ListItem
*/
protected $listItem;
/**
* MAL Model constructor.

View File

@ -28,6 +28,18 @@ const NOT_FOUND_METHOD = 'notFound';
const ERROR_MESSAGE_METHOD = 'errorPage';
const SRC_DIR = SRC_DIR;
/**
* Joins paths together. Variadic to take an
* arbitrary number of arguments
*
* @param string[] ...$args
* @return string
*/
function _dir(...$args)
{
return implode(DIRECTORY_SEPARATOR, $args);
}
/**
* Load configuration options from .toml files
*

View File

@ -72,7 +72,7 @@ class BaseCommand extends Command {
$config = loadToml($CONF_DIR);
$config_array = array_merge($base_config, $config);
$di = function ($config_array) use ($APP_DIR) {
$di = function ($config_array) {
$container = new Container();
// -------------------------------------------------------------------------

View File

@ -31,13 +31,13 @@ class SyncKitsuWithMal extends BaseCommand {
/**
* Model for making requests to Kitsu API
* @var Aviat\AnimeClient\API\Kitsu
* @var \Aviat\AnimeClient\API\Kitsu\Model
*/
protected $kitsuModel;
/**
* Model for making requests to MAL API
* @var Aviat\AnimeClient\API\MAL
* @var \Aviat\AnimeClient\API\MAL\Model
*/
protected $malModel;

View File

@ -18,6 +18,8 @@ namespace Aviat\AnimeClient;
use const Aviat\AnimeClient\SESSION_SEGMENT;
use function Aviat\AnimeClient\_dir;
use Aviat\Ion\Di\{ContainerAware, ContainerInterface};
use Aviat\Ion\View\{HtmlView, HttpView, JsonView};
use InvalidArgumentException;
@ -33,13 +35,13 @@ class Controller {
/**
* Cache manager
* @var \Aviat\Ion\Cache\CacheInterface
* @var \Psr\Cache\CacheItemPoolInterface
*/
protected $cache;
/**
* The global configuration object
* @var Aviat\Ion\ConfigInterface $config
* @var \Aviat\Ion\ConfigInterface $config
*/
protected $config;
@ -69,7 +71,7 @@ class Controller {
/**
* Session segment
* @var [type]
* @var \Aura\Session\Segment
*/
protected $session;
@ -307,7 +309,8 @@ class Controller {
$post = $this->request->getParsedBody();
if ($auth->authenticate($post['password']))
{
return $this->sessionRedirect();
$this->sessionRedirect();
return;
}
$this->setFlashMessage('Invalid username or password.');

View File

@ -45,7 +45,7 @@ class Anime extends BaseController {
/**
* Data cache
* @var Aviat\Ion\Cache\CacheInterface
* @var \Psr\Cache\CachePoolInterface
*/
protected $cache;

View File

@ -24,6 +24,8 @@ use const Aviat\AnimeClient\{
SRC_DIR
};
use function Aviat\AnimeClient\_dir;
use Aviat\Ion\Di\ContainerInterface;
use Aviat\Ion\Friend;
@ -46,7 +48,7 @@ class Dispatcher extends RoutingBase {
/**
* Class wrapper for input superglobals
* @var Psr\Http\Message\ServerRequestInterface
* @var \Psr\Http\Message\ServerRequestInterface
*/
protected $request;

View File

@ -33,14 +33,14 @@ class MenuGenerator extends UrlGenerator {
/**
* Html generation helper
*
* @var Aura\Html\HelperLocator
* @var \Aura\Html\HelperLocator
*/
protected $helper;
/**
* Request object
*
* @var Aura\Web\Request
* @var \Aura\Web\Request
*/
protected $request;

View File

@ -52,14 +52,14 @@ class Anime extends API {
/**
* Model for making requests to Kitsu API
*
* @var Aviat\AnimeClient\API\Kitsu\Model
* @var \Aviat\AnimeClient\API\Kitsu\Model
*/
protected $kitsuModel;
/**
* Model for making requests to MAL API
*
* @var Aviat\AnimeClient\API\MAL\Model
* @var \Aviat\AnimeClient\API\MAL\Model
*/
protected $malModel;

View File

@ -58,9 +58,15 @@ class Manga extends API
/**
* Model for making requests to Kitsu API
* @var Aviat\AnimeClient\API\Kitsu\KitsuModel
* @var \Aviat\AnimeClient\API\Kitsu\Model
*/
protected $kitsuModel;
/**
* Model for making requests to MAL API
* @var \Aviat\AnimeClient\API\MAL\Model
*/
protected $malModel;
/**
* Constructor
@ -70,6 +76,7 @@ class Manga extends API
public function __construct(ContainerInterface $container)
{
$this->kitsuModel = $container->get('kitsu-model');
$this->malModel = $container->get('mal-model');
}
/**

View File

@ -34,7 +34,7 @@ class RoutingBase {
/**
* Config Object
* @var Config
* @var \Aviat\Ion\Config
*/
protected $config;

View File

@ -22,6 +22,10 @@ use PHPUnit\Framework\TestCase;
class JsonAPITest extends TestCase {
protected $startData;
protected $organizedIncludes;
protected $inlineIncluded;
public function setUp()
{
$dir = __DIR__ . '/../test_data/JsonAPI';