From 14e8fa9f03e6a0a0e26f9026dca3088747668d85 Mon Sep 17 00:00:00 2001 From: "Timothy J. Warren" Date: Wed, 22 Feb 2017 15:08:29 -0500 Subject: [PATCH] More PHPStan fixes --- index.php | 15 ++---------- src/MenuGenerator.php | 2 +- tests/API/APIRequestBuilderTest.php | 2 ++ .../Transformer/AnimeListTransformerTest.php | 5 ++++ .../Transformer/AnimeTransformerTest.php | 5 ++++ .../Transformer/MangaListTransformerTest.php | 6 +++++ .../Transformer/MangaTransformerTest.php | 5 ++++ tests/API/ParallelAPIRequestTest.php | 2 +- tests/API/XMLTest.php | 6 +++++ tests/AnimeClientTest.php | 4 +++- tests/AnimeClientTestCase.php | 3 ++- tests/Command/BaseCommandTest.php | 3 +++ tests/ControllerTest.php | 2 ++ tests/DispatcherTest.php | 1 + tests/Helper/MenuHelperTest.php | 6 ++++- tests/RoutingBaseTest.php | 2 ++ tests/UtilTest.php | 2 ++ tests/bootstrap.php | 24 ++++--------------- 18 files changed, 57 insertions(+), 38 deletions(-) diff --git a/index.php b/index.php index 14eda8dc..e780cc78 100644 --- a/index.php +++ b/index.php @@ -28,25 +28,14 @@ if ($timezone === '' || $timezone === FALSE) ini_set('date.timezone', 'GMT'); } -/** - * Joins paths together. Variadic to take an - * arbitrary number of arguments - * - * @return string - */ -function _dir() -{ - return implode(DIRECTORY_SEPARATOR, func_get_args()); -} +// Load composer autoloader +require __DIR__ . '/vendor/autoload.php'; // Define base directories $APP_DIR = _dir(__DIR__, 'app'); $APPCONF_DIR = _dir($APP_DIR, 'appConf'); $CONF_DIR = _dir($APP_DIR, 'config'); -// Load composer autoloader -require _dir(__DIR__, 'vendor/autoload.php'); - // ------------------------------------------------------------------------- // Setup error handling // ------------------------------------------------------------------------- diff --git a/src/MenuGenerator.php b/src/MenuGenerator.php index c263ca75..1537608a 100644 --- a/src/MenuGenerator.php +++ b/src/MenuGenerator.php @@ -40,7 +40,7 @@ class MenuGenerator extends UrlGenerator { /** * Request object * - * @var \Aura\Web\Request + * @var \Psr\Http\Message\RequestInterface */ protected $request; diff --git a/tests/API/APIRequestBuilderTest.php b/tests/API/APIRequestBuilderTest.php index 1b51bdff..c349d5e8 100644 --- a/tests/API/APIRequestBuilderTest.php +++ b/tests/API/APIRequestBuilderTest.php @@ -24,6 +24,8 @@ use PHPUnit\Framework\TestCase; use Psr\Log\NullLogger; class APIRequestBuilderTest extends TestCase { + + protected $builder; public function setUp() { diff --git a/tests/API/Kitsu/Transformer/AnimeListTransformerTest.php b/tests/API/Kitsu/Transformer/AnimeListTransformerTest.php index 712ccc74..28e6d924 100644 --- a/tests/API/Kitsu/Transformer/AnimeListTransformerTest.php +++ b/tests/API/Kitsu/Transformer/AnimeListTransformerTest.php @@ -23,6 +23,11 @@ use Aviat\Ion\Json; class AnimeListTransformerTest extends AnimeClientTestCase { + protected $dir; + protected $beforeTransform; + protected $afterTransform; + protected $transformer; + public function setUp() { parent::setUp(); diff --git a/tests/API/Kitsu/Transformer/AnimeTransformerTest.php b/tests/API/Kitsu/Transformer/AnimeTransformerTest.php index d3ab1cf1..7047d494 100644 --- a/tests/API/Kitsu/Transformer/AnimeTransformerTest.php +++ b/tests/API/Kitsu/Transformer/AnimeTransformerTest.php @@ -23,6 +23,11 @@ use Aviat\Ion\Json; class AnimeTransformerTest extends AnimeClientTestCase { + protected $dir; + protected $beforeTransform; + protected $afterTransform; + protected $transformer; + public function setUp() { parent::setUp(); diff --git a/tests/API/Kitsu/Transformer/MangaListTransformerTest.php b/tests/API/Kitsu/Transformer/MangaListTransformerTest.php index 7a9c9546..f55af56d 100644 --- a/tests/API/Kitsu/Transformer/MangaListTransformerTest.php +++ b/tests/API/Kitsu/Transformer/MangaListTransformerTest.php @@ -22,6 +22,12 @@ use Aviat\AnimeClient\Tests\AnimeClientTestCase; use Aviat\Ion\Json; class MangaListTransformerTest extends AnimeClientTestCase { + + protected $dir; + protected $rawBefore; + protected $beforeTransform; + protected $afterTransform; + protected $transformer; public function setUp() { diff --git a/tests/API/Kitsu/Transformer/MangaTransformerTest.php b/tests/API/Kitsu/Transformer/MangaTransformerTest.php index fda3648c..bc14c37b 100644 --- a/tests/API/Kitsu/Transformer/MangaTransformerTest.php +++ b/tests/API/Kitsu/Transformer/MangaTransformerTest.php @@ -22,6 +22,11 @@ use Aviat\AnimeClient\Tests\AnimeClientTestCase; use Aviat\Ion\Json; class MangaTransformerTest extends AnimeClientTestCase { + + protected $dir; + protected $beforeTransform; + protected $afterTransform; + protected $transformer; public function setUp() { diff --git a/tests/API/ParallelAPIRequestTest.php b/tests/API/ParallelAPIRequestTest.php index e0d33945..18edb6af 100644 --- a/tests/API/ParallelAPIRequestTest.php +++ b/tests/API/ParallelAPIRequestTest.php @@ -6,7 +6,7 @@ use Aviat\AnimeClient\API\{APIRequestBuilder, ParallelAPIRequest}; use Aviat\Ion\Friend; use PHPUnit\Framework\TestCase; -class ParallelAPIRequestsTest extends TestCase { +class ParallelAPIRequestTest extends TestCase { public function testAddStringUrlRequest() { diff --git a/tests/API/XMLTest.php b/tests/API/XMLTest.php index 1e0ae2b0..7f2f7d2a 100644 --- a/tests/API/XMLTest.php +++ b/tests/API/XMLTest.php @@ -20,6 +20,12 @@ use Aviat\AnimeClient\API\XML; use PHPUnit\Framework\TestCase; class XMLTest extends TestCase { + + protected $malExport; + protected $xml; + protected $expectedXml; + protected $object; + protected $array; public function setUp() { diff --git a/tests/AnimeClientTest.php b/tests/AnimeClientTest.php index 0122541c..eaf08a3e 100644 --- a/tests/AnimeClientTest.php +++ b/tests/AnimeClientTest.php @@ -16,12 +16,14 @@ namespace Aviat\AnimeClient\Tests; +use function Aviat\AnimeClient\_dir; + class AnimeClientTest extends AnimeClientTestCase { /** * Basic sanity test for _dir function */ public function testDir() { - $this->assertEquals('foo' . \DIRECTORY_SEPARATOR . 'bar', \_dir('foo', 'bar')); + $this->assertEquals('foo' . \DIRECTORY_SEPARATOR . 'bar', _dir('foo', 'bar')); } } diff --git a/tests/AnimeClientTestCase.php b/tests/AnimeClientTestCase.php index 94b484eb..96dc764e 100644 --- a/tests/AnimeClientTestCase.php +++ b/tests/AnimeClientTestCase.php @@ -18,8 +18,9 @@ namespace Aviat\AnimeClient\Tests; use const Aviat\AnimeClient\SRC_DIR; +use function Aviat\AnimeClient\_dir; + use Aura\Web\WebFactory; -use Aviat\AnimeClient\AnimeClient; use Aviat\Ion\Json; use PHPUnit\Framework\TestCase; use Zend\Diactoros\{ diff --git a/tests/Command/BaseCommandTest.php b/tests/Command/BaseCommandTest.php index f70c1a58..3d89954e 100644 --- a/tests/Command/BaseCommandTest.php +++ b/tests/Command/BaseCommandTest.php @@ -22,6 +22,9 @@ use Aviat\Ion\Friend; use ConsoleKit\Console; class BaseCommandTest extends AnimeClientTestCase { + protected $base; + protected $friend; + public function setUp() { $this->base = new BaseCommand(new Console()); diff --git a/tests/ControllerTest.php b/tests/ControllerTest.php index 7421c6e7..25b42338 100644 --- a/tests/ControllerTest.php +++ b/tests/ControllerTest.php @@ -26,6 +26,8 @@ use Aviat\AnimeClient\Controller\{ }; class ControllerTest extends AnimeClientTestCase { + + protected $BaseController; public function setUp() { diff --git a/tests/DispatcherTest.php b/tests/DispatcherTest.php index 9650779c..cf884236 100644 --- a/tests/DispatcherTest.php +++ b/tests/DispatcherTest.php @@ -28,6 +28,7 @@ class DispatcherTest extends AnimeClientTestCase { protected $container; protected $router; protected $config; + protected $urlGenerator; protected function doSetUp($config, $uri, $host) { diff --git a/tests/Helper/MenuHelperTest.php b/tests/Helper/MenuHelperTest.php index 7226e989..61a02a3f 100644 --- a/tests/Helper/MenuHelperTest.php +++ b/tests/Helper/MenuHelperTest.php @@ -14,11 +14,15 @@ * @link https://github.com/timw4mail/HummingBirdAnimeClient */ -namespace Aviat\AnimeClient\Tests; +namespace Aviat\AnimeClient\Tests\Helper; use Aviat\AnimeClient\Helper\Menu as MenuHelper; +use Aviat\AnimeClient\Tests\AnimeClientTestCase; class MenuHelperTest extends AnimeClientTestCase { + + protected $helper; + protected $urlGenerator; public function setUp() { diff --git a/tests/RoutingBaseTest.php b/tests/RoutingBaseTest.php index 39aab47c..51165beb 100644 --- a/tests/RoutingBaseTest.php +++ b/tests/RoutingBaseTest.php @@ -19,6 +19,8 @@ namespace Aviat\AnimeClient\Tests; use Aviat\AnimeClient\RoutingBase; class RoutingBaseTest extends AnimeClientTestCase { + + protected $routingBase; public function setUp() { diff --git a/tests/UtilTest.php b/tests/UtilTest.php index 5278c635..968bc75c 100644 --- a/tests/UtilTest.php +++ b/tests/UtilTest.php @@ -19,6 +19,8 @@ namespace Aviat\AnimeClient\Tests; use Aviat\AnimeClient\Util; class UtilTest extends AnimeClientTestCase { + + protected $util; public function setUp() { diff --git a/tests/bootstrap.php b/tests/bootstrap.php index ec05319b..7073357f 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -10,28 +10,12 @@ if ($timezone === '' || $timezone === FALSE) ini_set('date.timezone', 'GMT'); } - -// ----------------------------------------------------------------------------- -// Global functions -// ----------------------------------------------------------------------------- - -/** - * Joins paths together. Variadic to take an - * arbitrary number of arguments - * - * @return string - */ -function _dir() -{ - return implode(DIRECTORY_SEPARATOR, func_get_args()); -} - // ----------------------------------------------------------------------------- // Autoloading // ----------------------------------------------------------------------------- -require _dir(__DIR__, 'AnimeClientTestCase.php'); -require _dir(__DIR__, '../vendor/autoload.php'); +require __DIR__ . '/AnimeClientTestCase.php'; +require __DIR__ . '/../vendor/autoload.php'; // ----------------------------------------------------------------------------- // Ini Settings @@ -51,7 +35,7 @@ $_SESSION = []; $_COOKIE = []; // Request base test case and mocks -require _dir(__DIR__, 'TestSessionHandler.php'); -require _dir(__DIR__, 'mocks.php'); +require __DIR__ . '/TestSessionHandler.php'; +require __DIR__ . '/mocks.php'; // End of bootstrap.php \ No newline at end of file