PHPStan fixes

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

View File

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

View File

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

View File

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

View File

@ -28,6 +28,18 @@ const NOT_FOUND_METHOD = 'notFound';
const ERROR_MESSAGE_METHOD = 'errorPage'; const ERROR_MESSAGE_METHOD = 'errorPage';
const SRC_DIR = SRC_DIR; 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 * Load configuration options from .toml files
* *

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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