diff --git a/tests/system/Router/Controllers/BlogController.php b/tests/system/Router/Controllers/BlogController.php index 2287d8ed4dec..cd22bc25357b 100644 --- a/tests/system/Router/Controllers/BlogController.php +++ b/tests/system/Router/Controllers/BlogController.php @@ -21,7 +21,7 @@ public function getIndex(): void { } - public function getSomeMethod($first = ''): void + public function getSomeMethod(string $first = ''): void { } } diff --git a/tests/system/Router/Controllers/Index.php b/tests/system/Router/Controllers/Index.php index 8b1c42ec9997..c17b9b086722 100644 --- a/tests/system/Router/Controllers/Index.php +++ b/tests/system/Router/Controllers/Index.php @@ -17,7 +17,7 @@ class Index extends Controller { - public function getIndex($p1 = ''): void + public function getIndex(string $p1 = ''): void { } diff --git a/tests/system/Router/Controllers/Mycontroller.php b/tests/system/Router/Controllers/Mycontroller.php index 75ad1eae026e..a568390188cf 100644 --- a/tests/system/Router/Controllers/Mycontroller.php +++ b/tests/system/Router/Controllers/Mycontroller.php @@ -21,7 +21,7 @@ public function getIndex(): void { } - public function getSomemethod($first = ''): void + public function getSomemethod(string $first = ''): void { } } diff --git a/tests/system/Router/Controllers/Remap.php b/tests/system/Router/Controllers/Remap.php index 35a7f4b577ac..ef570c423a65 100644 --- a/tests/system/Router/Controllers/Remap.php +++ b/tests/system/Router/Controllers/Remap.php @@ -18,7 +18,7 @@ class Remap extends Controller { - public function _remap(string $method, ...$params): string + public function _remap(string $method, mixed ...$params): string { $method = 'process_' . $method; diff --git a/tests/system/Router/Controllers/SubDir/BlogController.php b/tests/system/Router/Controllers/SubDir/BlogController.php index 78bfcdef0f1d..29a84a5dc467 100644 --- a/tests/system/Router/Controllers/SubDir/BlogController.php +++ b/tests/system/Router/Controllers/SubDir/BlogController.php @@ -21,7 +21,7 @@ public function getIndex(): void { } - public function getSomeMethod($first = ''): void + public function getSomeMethod(string $first = ''): void { } } diff --git a/tests/system/Router/Controllers/Subfolder/Home.php b/tests/system/Router/Controllers/Subfolder/Home.php index 386a86d81c66..5451aec202ea 100644 --- a/tests/system/Router/Controllers/Subfolder/Home.php +++ b/tests/system/Router/Controllers/Subfolder/Home.php @@ -17,7 +17,7 @@ class Home extends Controller { - public function getIndex($p1 = null, $p2 = null): void + public function getIndex(?string $p1 = null, ?string $p2 = null): void { } } diff --git a/tests/system/Router/Controllers/Subfolder/Sub/BlogController.php b/tests/system/Router/Controllers/Subfolder/Sub/BlogController.php index 9481c75050d8..3d2a733c25fe 100644 --- a/tests/system/Router/Controllers/Subfolder/Sub/BlogController.php +++ b/tests/system/Router/Controllers/Subfolder/Sub/BlogController.php @@ -21,7 +21,7 @@ public function getIndex(): void { } - public function getSomeMethod($first = ''): void + public function getSomeMethod(string $first = ''): void { } } diff --git a/tests/system/Router/DefinedRouteCollectorTest.php b/tests/system/Router/DefinedRouteCollectorTest.php index 2ec354c88893..329c582991bf 100644 --- a/tests/system/Router/DefinedRouteCollectorTest.php +++ b/tests/system/Router/DefinedRouteCollectorTest.php @@ -25,7 +25,7 @@ #[Group('Others')] final class DefinedRouteCollectorTest extends CIUnitTestCase { - private function createRouteCollection(array $config = [], $moduleConfig = null): RouteCollection + private function createRouteCollection(array $config = [], ?Modules $moduleConfig = null): RouteCollection { $defaults = [ 'Config' => APPPATH . 'Config', @@ -37,7 +37,7 @@ private function createRouteCollection(array $config = [], $moduleConfig = null) $loader = service('locator'); - if ($moduleConfig === null) { + if (! $moduleConfig instanceof Modules) { $moduleConfig = new Modules(); $moduleConfig->enabled = false; } diff --git a/tests/system/Router/RouteCollectionReverseRouteTest.php b/tests/system/Router/RouteCollectionReverseRouteTest.php index b468c021c87d..66428a13de99 100644 --- a/tests/system/Router/RouteCollectionReverseRouteTest.php +++ b/tests/system/Router/RouteCollectionReverseRouteTest.php @@ -35,7 +35,7 @@ protected function setUp(): void $this->resetFactories(); } - protected function getCollector(array $config = [], array $files = [], $moduleConfig = null): RouteCollection + protected function getCollector(array $config = [], array $files = [], ?Modules $moduleConfig = null): RouteCollection { $defaults = [ 'Config' => APPPATH . 'Config', @@ -47,7 +47,7 @@ protected function getCollector(array $config = [], array $files = [], $moduleCo $loader = service('locator'); - if ($moduleConfig === null) { + if (! $moduleConfig instanceof Modules) { $moduleConfig = new Modules(); $moduleConfig->enabled = false; } diff --git a/tests/system/Router/RouteCollectionTest.php b/tests/system/Router/RouteCollectionTest.php index 6346697d206a..4fbf7c69d8c1 100644 --- a/tests/system/Router/RouteCollectionTest.php +++ b/tests/system/Router/RouteCollectionTest.php @@ -44,7 +44,7 @@ protected function setUp(): void Services::injectMock('superglobals', new Superglobals()); } - protected function getCollector(array $config = [], array $files = [], $moduleConfig = null): RouteCollection + protected function getCollector(array $config = [], array $files = [], ?Modules $moduleConfig = null): RouteCollection { $defaults = [ 'Config' => APPPATH . 'Config', @@ -56,7 +56,7 @@ protected function getCollector(array $config = [], array $files = [], $moduleCo $loader = service('locator'); - if ($moduleConfig === null) { + if (! $moduleConfig instanceof Modules) { $moduleConfig = new Modules(); $moduleConfig->enabled = false; } diff --git a/utils/phpstan-baseline/missingType.parameter.neon b/utils/phpstan-baseline/missingType.parameter.neon index 0e1decdda219..082e239e62bb 100644 --- a/utils/phpstan-baseline/missingType.parameter.neon +++ b/utils/phpstan-baseline/missingType.parameter.neon @@ -1,4 +1,4 @@ -# total 30 errors +# total 20 errors parameters: ignoreErrors: @@ -87,61 +87,6 @@ parameters: count: 1 path: ../../tests/system/Helpers/URLHelper/SiteUrlTest.php - - - message: '#^Method CodeIgniter\\Router\\Controllers\\BlogController\:\:getSomeMethod\(\) has parameter \$first with no type specified\.$#' - count: 1 - path: ../../tests/system/Router/Controllers/BlogController.php - - - - message: '#^Method CodeIgniter\\Router\\Controllers\\Index\:\:getIndex\(\) has parameter \$p1 with no type specified\.$#' - count: 1 - path: ../../tests/system/Router/Controllers/Index.php - - - - message: '#^Method CodeIgniter\\Router\\Controllers\\Mycontroller\:\:getSomemethod\(\) has parameter \$first with no type specified\.$#' - count: 1 - path: ../../tests/system/Router/Controllers/Mycontroller.php - - - - message: '#^Method CodeIgniter\\Router\\Controllers\\Remap\:\:_remap\(\) has parameter \$params with no type specified\.$#' - count: 1 - path: ../../tests/system/Router/Controllers/Remap.php - - - - message: '#^Method CodeIgniter\\Router\\Controllers\\SubDir\\BlogController\:\:getSomeMethod\(\) has parameter \$first with no type specified\.$#' - count: 1 - path: ../../tests/system/Router/Controllers/SubDir/BlogController.php - - - - message: '#^Method CodeIgniter\\Router\\Controllers\\Subfolder\\Home\:\:getIndex\(\) has parameter \$p1 with no type specified\.$#' - count: 1 - path: ../../tests/system/Router/Controllers/Subfolder/Home.php - - - - message: '#^Method CodeIgniter\\Router\\Controllers\\Subfolder\\Home\:\:getIndex\(\) has parameter \$p2 with no type specified\.$#' - count: 1 - path: ../../tests/system/Router/Controllers/Subfolder/Home.php - - - - message: '#^Method CodeIgniter\\Router\\Controllers\\Subfolder\\Sub\\BlogController\:\:getSomeMethod\(\) has parameter \$first with no type specified\.$#' - count: 1 - path: ../../tests/system/Router/Controllers/Subfolder/Sub/BlogController.php - - - - message: '#^Method CodeIgniter\\Router\\DefinedRouteCollectorTest\:\:createRouteCollection\(\) has parameter \$moduleConfig with no type specified\.$#' - count: 1 - path: ../../tests/system/Router/DefinedRouteCollectorTest.php - - - - message: '#^Method CodeIgniter\\Router\\RouteCollectionReverseRouteTest\:\:getCollector\(\) has parameter \$moduleConfig with no type specified\.$#' - count: 1 - path: ../../tests/system/Router/RouteCollectionReverseRouteTest.php - - - - message: '#^Method CodeIgniter\\Router\\RouteCollectionTest\:\:getCollector\(\) has parameter \$moduleConfig with no type specified\.$#' - count: 1 - path: ../../tests/system/Router/RouteCollectionTest.php - - message: '#^Method CodeIgniter\\Security\\SecurityCSRFSessionRandomizeTokenTest\:\:createSession\(\) has parameter \$options with no type specified\.$#' count: 1