From 24df15629d1ae78b198e89ed6439e3570afcab19 Mon Sep 17 00:00:00 2001 From: kenjis Date: Tue, 28 Jun 2022 07:10:48 +0900 Subject: [PATCH] refactor: run rector and tweak --- tests/system/CLI/ConsoleTest.php | 6 +--- tests/system/CommonFunctionsTest.php | 6 +--- tests/system/Config/DotEnvTest.php | 8 ++--- tests/system/ControllerTest.php | 5 +--- tests/system/Database/Live/MetadataTest.php | 10 ++----- .../system/HTTP/ContentSecurityPolicyTest.php | 11 ++----- tests/system/HTTP/Files/FileMovingTest.php | 20 +++---------- tests/system/Helpers/CookieHelperTest.php | 2 +- tests/system/Helpers/FilesystemHelperTest.php | 2 +- tests/system/Images/BaseHandlerTest.php | 23 +++------------ tests/system/Images/GDHandlerTest.php | 29 ++++--------------- .../system/Images/ImageMagickHandlerTest.php | 23 +++------------ tests/system/Images/ImageTest.php | 20 +++---------- tests/system/Log/Handlers/FileHandlerTest.php | 11 ++----- tests/system/Pager/PagerRendererTest.php | 6 +--- tests/system/Throttle/ThrottleTest.php | 6 ++-- tests/system/View/TableTest.php | 5 +--- 17 files changed, 39 insertions(+), 154 deletions(-) diff --git a/tests/system/CLI/ConsoleTest.php b/tests/system/CLI/ConsoleTest.php index e45afff92b04..1d24e1dd778c 100644 --- a/tests/system/CLI/ConsoleTest.php +++ b/tests/system/CLI/ConsoleTest.php @@ -24,11 +24,7 @@ */ final class ConsoleTest extends CIUnitTestCase { - /** - * @var DotEnv - */ - private $env; - + private DotEnv $env; private $stream_filter; protected function setUp(): void diff --git a/tests/system/CommonFunctionsTest.php b/tests/system/CommonFunctionsTest.php index 1fe8f3fec573..9143198cb839 100644 --- a/tests/system/CommonFunctionsTest.php +++ b/tests/system/CommonFunctionsTest.php @@ -43,11 +43,7 @@ */ final class CommonFunctionsTest extends CIUnitTestCase { - /** - * @var App - */ - private $config; - + private ?App $config = null; public MockIncomingRequest $request; protected function setUp(): void diff --git a/tests/system/Config/DotEnvTest.php b/tests/system/Config/DotEnvTest.php index efcc4c5b5ef1..aa718bd6dea6 100644 --- a/tests/system/Config/DotEnvTest.php +++ b/tests/system/Config/DotEnvTest.php @@ -24,12 +24,8 @@ */ final class DotEnvTest extends CIUnitTestCase { - /** - * @var vfsStreamDirectory|null - */ - private $root; - - public string $path; + private ?vfsStreamDirectory $root; + private string $path; private $fixturesFolder; protected function setUp(): void diff --git a/tests/system/ControllerTest.php b/tests/system/ControllerTest.php index ed98067f62ef..cc77c7507b15 100644 --- a/tests/system/ControllerTest.php +++ b/tests/system/ControllerTest.php @@ -33,10 +33,7 @@ */ final class ControllerTest extends CIUnitTestCase { - /** - * @var App - */ - private $config; + private App $config; /** * @var Controller diff --git a/tests/system/Database/Live/MetadataTest.php b/tests/system/Database/Live/MetadataTest.php index 7f8df06ad708..40a16043c76a 100644 --- a/tests/system/Database/Live/MetadataTest.php +++ b/tests/system/Database/Live/MetadataTest.php @@ -26,13 +26,9 @@ final class MetadataTest extends CIUnitTestCase { use DatabaseTestTrait; - /** - * @var Forge - */ - private $forge; - - protected $refresh = true; - protected $seed = CITestSeeder::class; + private ?Forge $forge = null; + protected $refresh = true; + protected $seed = CITestSeeder::class; /** * Array of expected tables. diff --git a/tests/system/HTTP/ContentSecurityPolicyTest.php b/tests/system/HTTP/ContentSecurityPolicyTest.php index 7dd221011542..71a1fa491143 100644 --- a/tests/system/HTTP/ContentSecurityPolicyTest.php +++ b/tests/system/HTTP/ContentSecurityPolicyTest.php @@ -27,15 +27,8 @@ */ final class ContentSecurityPolicyTest extends CIUnitTestCase { - /** - * @var Response - */ - private $response; - - /** - * @var \CodeIgniter\HTTP\ContentSecurityPolicy - */ - private $csp; + private ?Response $response = null; + private ?\CodeIgniter\HTTP\ContentSecurityPolicy $csp = null; // Having this method as setUp() doesn't work - can't find Config\App !? protected function prepare(bool $CSPEnabled = true) diff --git a/tests/system/HTTP/Files/FileMovingTest.php b/tests/system/HTTP/Files/FileMovingTest.php index ef42ca3b314c..204579dd3da0 100644 --- a/tests/system/HTTP/Files/FileMovingTest.php +++ b/tests/system/HTTP/Files/FileMovingTest.php @@ -21,22 +21,10 @@ */ final class FileMovingTest extends CIUnitTestCase { - /** - * @var vfsStreamDirectory|null - */ - private $root; - - public string $path; - - /** - * @var string - */ - private $start; - - /** - * @var string - */ - private $destination; + private ?vfsStreamDirectory $root; + private string $path; + private string $start; + private string $destination; protected function setUp(): void { diff --git a/tests/system/Helpers/CookieHelperTest.php b/tests/system/Helpers/CookieHelperTest.php index 90a5abc2cf2c..852b13361f70 100755 --- a/tests/system/Helpers/CookieHelperTest.php +++ b/tests/system/Helpers/CookieHelperTest.php @@ -28,7 +28,7 @@ */ final class CookieHelperTest extends CIUnitTestCase { - public IncomingRequest $request; + private IncomingRequest $request; private $name; private string $value; private int $expire; diff --git a/tests/system/Helpers/FilesystemHelperTest.php b/tests/system/Helpers/FilesystemHelperTest.php index 7744bf82cf17..00acb804394d 100644 --- a/tests/system/Helpers/FilesystemHelperTest.php +++ b/tests/system/Helpers/FilesystemHelperTest.php @@ -23,7 +23,7 @@ final class FilesystemHelperTest extends CIUnitTestCase /** * @var array>|array>|array|array|array|mixed */ - private $structure; + private array $structure; protected function setUp(): void { diff --git a/tests/system/Images/BaseHandlerTest.php b/tests/system/Images/BaseHandlerTest.php index 504459c48fe2..a2cce0634e0a 100644 --- a/tests/system/Images/BaseHandlerTest.php +++ b/tests/system/Images/BaseHandlerTest.php @@ -31,25 +31,10 @@ */ final class BaseHandlerTest extends CIUnitTestCase { - /** - * @var vfsStreamDirectory - */ - private $root; - - /** - * @var string - */ - private $origin; - - /** - * @var string - */ - private $start; - - /** - * @var string - */ - private $path; + private vfsStreamDirectory $root; + private string $origin; + private string $start; + private string $path; protected function setUp(): void { diff --git a/tests/system/Images/GDHandlerTest.php b/tests/system/Images/GDHandlerTest.php index b060c2b4be25..46db29f87118 100644 --- a/tests/system/Images/GDHandlerTest.php +++ b/tests/system/Images/GDHandlerTest.php @@ -31,30 +31,11 @@ */ final class GDHandlerTest extends CIUnitTestCase { - /** - * @var vfsStreamDirectory - */ - private $root; - - /** - * @var string - */ - private $origin; - - /** - * @var string - */ - private $start; - - /** - * @var string - */ - private $path; - - /** - * @var BaseHandler - */ - private $handler; + private vfsStreamDirectory $root; + private string $origin; + private string $start; + private string $path; + private BaseHandler $handler; protected function setUp(): void { diff --git a/tests/system/Images/ImageMagickHandlerTest.php b/tests/system/Images/ImageMagickHandlerTest.php index 2efa53500817..77fa8fee87b1 100644 --- a/tests/system/Images/ImageMagickHandlerTest.php +++ b/tests/system/Images/ImageMagickHandlerTest.php @@ -31,25 +31,10 @@ */ final class ImageMagickHandlerTest extends CIUnitTestCase { - /** - * @var string - */ - private $root; - - /** - * @var string - */ - private $origin; - - /** - * @var string - */ - private $path; - - /** - * @var BaseHandler - */ - private $handler; + private string $root; + private string $origin; + private string $path; + private BaseHandler $handler; protected function setUp(): void { diff --git a/tests/system/Images/ImageTest.php b/tests/system/Images/ImageTest.php index d751476548d2..a85ed30c83fd 100644 --- a/tests/system/Images/ImageTest.php +++ b/tests/system/Images/ImageTest.php @@ -21,22 +21,10 @@ */ final class ImageTest extends CIUnitTestCase { - /** - * @var vfsStreamDirectory - */ - private $root; - - public string $origin; - - /** - * @var string - */ - private $start; - - /** - * @var Image - */ - private $image; + private vfsStreamDirectory $root; + private string $origin; + private string $start; + private Image $image; protected function setUp(): void { diff --git a/tests/system/Log/Handlers/FileHandlerTest.php b/tests/system/Log/Handlers/FileHandlerTest.php index f80412e5bea6..050511a63465 100644 --- a/tests/system/Log/Handlers/FileHandlerTest.php +++ b/tests/system/Log/Handlers/FileHandlerTest.php @@ -23,15 +23,8 @@ */ final class FileHandlerTest extends CIUnitTestCase { - /** - * @var vfsStreamDirectory - */ - private $root; - - /** - * @var string - */ - private $start; + private vfsStreamDirectory $root; + private string $start; protected function setUp(): void { diff --git a/tests/system/Pager/PagerRendererTest.php b/tests/system/Pager/PagerRendererTest.php index 94951c02e29b..54f8019b4424 100644 --- a/tests/system/Pager/PagerRendererTest.php +++ b/tests/system/Pager/PagerRendererTest.php @@ -19,11 +19,7 @@ */ final class PagerRendererTest extends CIUnitTestCase { - /** - * @var string - */ - private $expect; - + private string $expect; private URI $uri; protected function setUp(): void diff --git a/tests/system/Throttle/ThrottleTest.php b/tests/system/Throttle/ThrottleTest.php index bb83e11b3cf9..a26723925e1f 100644 --- a/tests/system/Throttle/ThrottleTest.php +++ b/tests/system/Throttle/ThrottleTest.php @@ -11,6 +11,7 @@ namespace CodeIgniter\Throttle; +use CodeIgniter\Cache\CacheInterface; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\Mock\MockCache; @@ -19,10 +20,7 @@ */ final class ThrottleTest extends CIUnitTestCase { - /** - * @var Cache - */ - private $cache; + private CacheInterface $cache; protected function setUp(): void { diff --git a/tests/system/View/TableTest.php b/tests/system/View/TableTest.php index cccaa4ced597..261c89ca023d 100644 --- a/tests/system/View/TableTest.php +++ b/tests/system/View/TableTest.php @@ -21,10 +21,7 @@ */ final class TableTest extends CIUnitTestCase { - /** - * @var Table - */ - private $table; + private Table $table; protected function setUp(): void {