From 59711f2973e83527231ca299f565f743b7abf45d Mon Sep 17 00:00:00 2001 From: "John Paul E. Balandan, CPA" Date: Sat, 12 Apr 2025 22:33:35 +0800 Subject: [PATCH] Fix variable.undefined (and other) errors --- phpstan.neon.dist | 89 ++++--- system/Cache/Handlers/FileHandler.php | 4 +- system/Helpers/filesystem_helper.php | 4 +- system/Session/Handlers/FileHandler.php | 4 +- system/Test/FilterTestTrait.php | 4 + utils/phpstan-baseline/argument.type.neon | 7 +- utils/phpstan-baseline/loader.neon | 3 +- .../method.childParameterType.neon | 42 +-- .../method.childReturnType.neon | 12 +- utils/phpstan-baseline/method.notFound.neon | 7 +- .../missingType.iterableValue.neon | 152 +---------- .../missingType.parameter.neon | 87 +----- .../missingType.property.neon | 57 +--- .../phpstan-baseline/missingType.return.neon | 252 +----------------- .../property.defaultValue.neon | 12 +- .../ternary.shortNotAllowed.neon | 7 +- .../phpstan-baseline/variable.undefined.neon | 78 ------ 17 files changed, 70 insertions(+), 751 deletions(-) delete mode 100644 utils/phpstan-baseline/variable.undefined.neon diff --git a/phpstan.neon.dist b/phpstan.neon.dist index 43d658c22c35..bc3a0fc7ef34 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -1,46 +1,49 @@ includes: - - utils/phpstan-baseline/loader.neon + - utils/phpstan-baseline/loader.neon parameters: - phpVersion: 80100 - tmpDir: build/phpstan - level: 6 - bootstrapFiles: - - phpstan-bootstrap.php - paths: - - admin/starter/tests - - app - - system - - tests - excludePaths: - - app/Views/errors/cli/* - - app/Views/errors/html/* - - system/Commands/Generators/Views/* - - system/Debug/Toolbar/Views/toolbar.tpl.php - - system/Images/Handlers/GDHandler.php - - system/Test/Filters/CITestStreamFilter.php - - system/ThirdParty/* - - system/Validation/Views/single.php - - tests/system/View/Views/* - scanDirectories: - - system/Helpers - ignoreErrors: - - - identifier: missingType.generics - checkMissingCallableSignature: true - treatPhpDocTypesAsCertain: false - strictRules: - allRules: false - disallowedLooseComparison: true - booleansInConditions: true - disallowedBacktick: true - disallowedEmpty: true - disallowedImplicitArrayCreation: true - disallowedShortTernary: true - matchingInheritedMethodNames: true - codeigniter: - additionalServices: - - AfterAutoloadModule\Config\Services - checkArgumentTypeOfModel: false - shipmonkBaselinePerIdentifier: - directory: %currentWorkingDirectory% + phpVersion: 80100 + tmpDir: build/phpstan + level: 6 + bootstrapFiles: + - phpstan-bootstrap.php + paths: + - admin/starter/tests + - app + - system + - tests + excludePaths: + analyseAndScan: + - app/Views/errors/cli/* + - app/Views/errors/html/* + - system/Commands/Generators/Views/* + - system/Debug/Toolbar/Views/toolbar.tpl.php + - system/Images/Handlers/GDHandler.php + - system/Test/Filters/CITestStreamFilter.php + - system/ThirdParty/* + - system/Validation/Views/single.php + - tests/system/View/Views/* + analyse: + - tests/_support/* + scanDirectories: + - system/Helpers + ignoreErrors: + - + identifier: missingType.generics + checkMissingCallableSignature: true + treatPhpDocTypesAsCertain: false + strictRules: + allRules: false + disallowedLooseComparison: true + booleansInConditions: true + disallowedBacktick: true + disallowedEmpty: true + disallowedImplicitArrayCreation: true + disallowedShortTernary: true + matchingInheritedMethodNames: true + codeigniter: + additionalServices: + - AfterAutoloadModule\Config\Services + checkArgumentTypeOfModel: false + shipmonkBaselinePerIdentifier: + directory: %currentWorkingDirectory% diff --git a/system/Cache/Handlers/FileHandler.php b/system/Cache/Handlers/FileHandler.php index 8f63c93acb20..4fd03e7921b0 100644 --- a/system/Cache/Handlers/FileHandler.php +++ b/system/Cache/Handlers/FileHandler.php @@ -269,7 +269,9 @@ protected function writeFile($path, $data, $mode = 'wb') flock($fp, LOCK_EX); - for ($result = $written = 0, $length = strlen($data); $written < $length; $written += $result) { + $result = 0; + + for ($written = 0, $length = strlen($data); $written < $length; $written += $result) { if (($result = fwrite($fp, substr($data, $written))) === false) { break; } diff --git a/system/Helpers/filesystem_helper.php b/system/Helpers/filesystem_helper.php index c45bcdae0d64..aa7efbea0468 100644 --- a/system/Helpers/filesystem_helper.php +++ b/system/Helpers/filesystem_helper.php @@ -123,7 +123,9 @@ function write_file(string $path, string $data, string $mode = 'wb'): bool flock($fp, LOCK_EX); - for ($result = $written = 0, $length = strlen($data); $written < $length; $written += $result) { + $result = 0; + + for ($written = 0, $length = strlen($data); $written < $length; $written += $result) { if (($result = fwrite($fp, substr($data, $written))) === false) { break; } diff --git a/system/Session/Handlers/FileHandler.php b/system/Session/Handlers/FileHandler.php index 68fcd894c583..dbca9cfa4288 100644 --- a/system/Session/Handlers/FileHandler.php +++ b/system/Session/Handlers/FileHandler.php @@ -201,7 +201,9 @@ public function write($id, $data): bool if (($length = strlen($data)) > 0) { $result = null; - for ($written = 0; $written < $length; $written += $result) { + $written = 0; + + for (; $written < $length; $written += $result) { if (($result = fwrite($this->fileHandle, substr($data, $written))) === false) { break; } diff --git a/system/Test/FilterTestTrait.php b/system/Test/FilterTestTrait.php index d3091b6b4ed7..45411fad0a42 100644 --- a/system/Test/FilterTestTrait.php +++ b/system/Test/FilterTestTrait.php @@ -163,6 +163,8 @@ protected function getFilterCaller($filter, string $position): Closure if ($position === 'before') { return static function (?array $params = null) use ($filterInstances, $request) { + $result = null; + foreach ($filterInstances as $filter) { $result = $filter->before($request, $params); @@ -188,6 +190,8 @@ protected function getFilterCaller($filter, string $position): Closure $response = clone $this->response; return static function (?array $params = null) use ($filterInstances, $request, $response) { + $result = null; + foreach ($filterInstances as $filter) { $result = $filter->after($request, $response, $params); diff --git a/utils/phpstan-baseline/argument.type.neon b/utils/phpstan-baseline/argument.type.neon index 011377a40084..6e6aa7de51fc 100644 --- a/utils/phpstan-baseline/argument.type.neon +++ b/utils/phpstan-baseline/argument.type.neon @@ -1,4 +1,4 @@ -# total 148 errors +# total 146 errors parameters: ignoreErrors: @@ -32,11 +32,6 @@ parameters: count: 1 path: ../../system/Log/Handlers/ErrorlogHandler.php - - - message: '#^Parameter \#1 \$fields of method CodeIgniter\\Database\\Forge\:\:addField\(\) expects array\\|string, array\\|string\> given\.$#' - count: 2 - path: ../../tests/_support/Database/Migrations/20160428212500_Create_test_tables.php - - message: '#^Parameter \#2 \$to of method CodeIgniter\\Router\\RouteCollection\:\:add\(\) expects array\|\(Closure\(mixed \.\.\.\)\: \(CodeIgniter\\HTTP\\ResponseInterface\|string\|void\)\)\|string, Closure\(mixed\)\: \(CodeIgniter\\HTTP\\DownloadResponse\|null\) given\.$#' count: 1 diff --git a/utils/phpstan-baseline/loader.neon b/utils/phpstan-baseline/loader.neon index 11c2852f5c57..1372386f4cae 100644 --- a/utils/phpstan-baseline/loader.neon +++ b/utils/phpstan-baseline/loader.neon @@ -1,4 +1,4 @@ -# total 3760 errors +# total 3615 errors includes: - argument.type.neon - assign.propertyType.neon @@ -39,4 +39,3 @@ includes: - staticMethod.notFound.neon - ternary.shortNotAllowed.neon - varTag.type.neon - - variable.undefined.neon diff --git a/utils/phpstan-baseline/method.childParameterType.neon b/utils/phpstan-baseline/method.childParameterType.neon index 5d9df4b2cdf3..0d10e9cd49d6 100644 --- a/utils/phpstan-baseline/method.childParameterType.neon +++ b/utils/phpstan-baseline/method.childParameterType.neon @@ -1,4 +1,4 @@ -# total 17 errors +# total 9 errors parameters: ignoreErrors: @@ -46,43 +46,3 @@ parameters: message: '#^Parameter \#1 \$level \(string\) of method CodeIgniter\\Log\\Logger\:\:log\(\) should be contravariant with parameter \$level \(mixed\) of method Psr\\Log\\LoggerInterface\:\:log\(\)$#' count: 1 path: ../../system/Log/Logger.php - - - - message: '#^Parameter \#1 \$value \(string\) of method Tests\\Support\\Entity\\Cast\\CastBase64\:\:get\(\) should be contravariant with parameter \$value \(array\|bool\|float\|int\|object\|string\|null\) of method CodeIgniter\\Entity\\Cast\\BaseCast\:\:get\(\)$#' - count: 1 - path: ../../tests/_support/Entity/Cast/CastBase64.php - - - - message: '#^Parameter \#1 \$value \(string\) of method Tests\\Support\\Entity\\Cast\\CastBase64\:\:get\(\) should be contravariant with parameter \$value \(array\|bool\|float\|int\|object\|string\|null\) of method CodeIgniter\\Entity\\Cast\\CastInterface\:\:get\(\)$#' - count: 1 - path: ../../tests/_support/Entity/Cast/CastBase64.php - - - - message: '#^Parameter \#1 \$value \(string\) of method Tests\\Support\\Entity\\Cast\\CastBase64\:\:set\(\) should be contravariant with parameter \$value \(array\|bool\|float\|int\|object\|string\|null\) of method CodeIgniter\\Entity\\Cast\\BaseCast\:\:set\(\)$#' - count: 1 - path: ../../tests/_support/Entity/Cast/CastBase64.php - - - - message: '#^Parameter \#1 \$value \(string\) of method Tests\\Support\\Entity\\Cast\\CastBase64\:\:set\(\) should be contravariant with parameter \$value \(array\|bool\|float\|int\|object\|string\|null\) of method CodeIgniter\\Entity\\Cast\\CastInterface\:\:set\(\)$#' - count: 1 - path: ../../tests/_support/Entity/Cast/CastBase64.php - - - - message: '#^Parameter \#1 \$binary \(string\) of method Tests\\Support\\Entity\\Cast\\CastBinaryUUID\:\:get\(\) should be contravariant with parameter \$value \(array\|bool\|float\|int\|object\|string\|null\) of method CodeIgniter\\Entity\\Cast\\BaseCast\:\:get\(\)$#' - count: 1 - path: ../../tests/_support/Entity/Cast/CastBinaryUUID.php - - - - message: '#^Parameter \#1 \$binary \(string\) of method Tests\\Support\\Entity\\Cast\\CastBinaryUUID\:\:get\(\) should be contravariant with parameter \$value \(array\|bool\|float\|int\|object\|string\|null\) of method CodeIgniter\\Entity\\Cast\\CastInterface\:\:get\(\)$#' - count: 1 - path: ../../tests/_support/Entity/Cast/CastBinaryUUID.php - - - - message: '#^Parameter \#1 \$string \(string\) of method Tests\\Support\\Entity\\Cast\\CastBinaryUUID\:\:set\(\) should be contravariant with parameter \$value \(array\|bool\|float\|int\|object\|string\|null\) of method CodeIgniter\\Entity\\Cast\\BaseCast\:\:set\(\)$#' - count: 1 - path: ../../tests/_support/Entity/Cast/CastBinaryUUID.php - - - - message: '#^Parameter \#1 \$string \(string\) of method Tests\\Support\\Entity\\Cast\\CastBinaryUUID\:\:set\(\) should be contravariant with parameter \$value \(array\|bool\|float\|int\|object\|string\|null\) of method CodeIgniter\\Entity\\Cast\\CastInterface\:\:set\(\)$#' - count: 1 - path: ../../tests/_support/Entity/Cast/CastBinaryUUID.php diff --git a/utils/phpstan-baseline/method.childReturnType.neon b/utils/phpstan-baseline/method.childReturnType.neon index e2fcf04827da..f443154a490d 100644 --- a/utils/phpstan-baseline/method.childReturnType.neon +++ b/utils/phpstan-baseline/method.childReturnType.neon @@ -1,4 +1,4 @@ -# total 40 errors +# total 38 errors parameters: ignoreErrors: @@ -186,13 +186,3 @@ parameters: message: '#^Return type \(mixed\) of method CodeIgniter\\Test\\Mock\\MockResult\:\:fetchAssoc\(\) should be covariant with return type \(array\|false\|null\) of method CodeIgniter\\Database\\BaseResult\\:\:fetchAssoc\(\)$#' count: 1 path: ../../system/Test/Mock/MockResult.php - - - - message: '#^Return type \(mixed\) of method Tests\\Support\\Entity\\Cast\\CastPassParameters\:\:set\(\) should be covariant with return type \(array\|bool\|float\|int\|object\|string\|null\) of method CodeIgniter\\Entity\\Cast\\BaseCast\:\:set\(\)$#' - count: 1 - path: ../../tests/_support/Entity/Cast/CastPassParameters.php - - - - message: '#^Return type \(mixed\) of method Tests\\Support\\Entity\\Cast\\CastPassParameters\:\:set\(\) should be covariant with return type \(array\|bool\|float\|int\|object\|string\|null\) of method CodeIgniter\\Entity\\Cast\\CastInterface\:\:set\(\)$#' - count: 1 - path: ../../tests/_support/Entity/Cast/CastPassParameters.php diff --git a/utils/phpstan-baseline/method.notFound.neon b/utils/phpstan-baseline/method.notFound.neon index 71e25c746678..445f071fb3c2 100644 --- a/utils/phpstan-baseline/method.notFound.neon +++ b/utils/phpstan-baseline/method.notFound.neon @@ -1,4 +1,4 @@ -# total 83 errors +# total 82 errors parameters: ignoreErrors: @@ -17,11 +17,6 @@ parameters: count: 2 path: ../../system/Debug/Toolbar/Collectors/Views.php - - - message: '#^Call to an undefined method CodeIgniter\\Database\\ConnectionInterface\:\:tableExists\(\)\.$#' - count: 1 - path: ../../tests/_support/MigrationTestMigrations/Database/Migrations/2018-01-24-102302_Another_migration.php - - message: '#^Call to an undefined method CodeIgniter\\HTTP\\ResponseInterface\:\:pretend\(\)\.$#' count: 1 diff --git a/utils/phpstan-baseline/missingType.iterableValue.neon b/utils/phpstan-baseline/missingType.iterableValue.neon index 9f19deb6ea78..e8c7da4e7a0a 100644 --- a/utils/phpstan-baseline/missingType.iterableValue.neon +++ b/utils/phpstan-baseline/missingType.iterableValue.neon @@ -1,4 +1,4 @@ -# total 1659 errors +# total 1629 errors parameters: ignoreErrors: @@ -6242,156 +6242,6 @@ parameters: count: 1 path: ../../system/View/Parser.php - - - message: '#^Method Tests\\Support\\Controllers\\Popcorn\:\:fail\(\) has parameter \$messages with no value type specified in iterable type array\.$#' - count: 1 - path: ../../tests/_support/Controllers/Popcorn.php - - - - message: '#^Method Tests\\Support\\Controllers\\Popcorn\:\:format\(\) has parameter \$data with no value type specified in iterable type array\.$#' - count: 1 - path: ../../tests/_support/Controllers/Popcorn.php - - - - message: '#^Method Tests\\Support\\Controllers\\Popcorn\:\:respond\(\) has parameter \$data with no value type specified in iterable type array\.$#' - count: 1 - path: ../../tests/_support/Controllers/Popcorn.php - - - - message: '#^Method Tests\\Support\\Controllers\\Popcorn\:\:respondCreated\(\) has parameter \$data with no value type specified in iterable type array\.$#' - count: 1 - path: ../../tests/_support/Controllers/Popcorn.php - - - - message: '#^Method Tests\\Support\\Controllers\\Popcorn\:\:respondDeleted\(\) has parameter \$data with no value type specified in iterable type array\.$#' - count: 1 - path: ../../tests/_support/Controllers/Popcorn.php - - - - message: '#^Method Tests\\Support\\Controllers\\Popcorn\:\:respondUpdated\(\) has parameter \$data with no value type specified in iterable type array\.$#' - count: 1 - path: ../../tests/_support/Controllers/Popcorn.php - - - - message: '#^Method Tests\\Support\\Entity\\Cast\\CastBase64\:\:get\(\) has parameter \$params with no value type specified in iterable type array\.$#' - count: 1 - path: ../../tests/_support/Entity/Cast/CastBase64.php - - - - message: '#^Method Tests\\Support\\Entity\\Cast\\CastBase64\:\:set\(\) has parameter \$params with no value type specified in iterable type array\.$#' - count: 1 - path: ../../tests/_support/Entity/Cast/CastBase64.php - - - - message: '#^Method Tests\\Support\\Entity\\Cast\\CastBinaryUUID\:\:get\(\) has parameter \$params with no value type specified in iterable type array\.$#' - count: 1 - path: ../../tests/_support/Entity/Cast/CastBinaryUUID.php - - - - message: '#^Method Tests\\Support\\Entity\\Cast\\CastBinaryUUID\:\:set\(\) has parameter \$params with no value type specified in iterable type array\.$#' - count: 1 - path: ../../tests/_support/Entity/Cast/CastBinaryUUID.php - - - - message: '#^Method Tests\\Support\\Entity\\Cast\\CastPassParameters\:\:set\(\) has parameter \$params with no value type specified in iterable type array\.$#' - count: 1 - path: ../../tests/_support/Entity/Cast/CastPassParameters.php - - - - message: '#^Class Tests\\Support\\Entity\\CustomUser has PHPDoc tag @property for property \$email with no value type specified in iterable type array\.$#' - count: 1 - path: ../../tests/_support/Entity/CustomUser.php - - - - message: '#^Method Tests\\Support\\Entity\\CustomUser\:\:__construct\(\) has parameter \$email with no value type specified in iterable type array\.$#' - count: 1 - path: ../../tests/_support/Entity/CustomUser.php - - - - message: '#^Method Tests\\Support\\Entity\\CustomUser\:\:reconstruct\(\) has parameter \$data with no value type specified in iterable type array\.$#' - count: 1 - path: ../../tests/_support/Entity/CustomUser.php - - - - message: '#^Method Tests\\Support\\Log\\Handlers\\TestHandler\:\:__construct\(\) has parameter \$config with no value type specified in iterable type array\.$#' - count: 1 - path: ../../tests/_support/Log/Handlers/TestHandler.php - - - - message: '#^Property Tests\\Support\\Log\\Handlers\\TestHandler\:\:\$logs type has no value type specified in iterable type array\.$#' - count: 1 - path: ../../tests/_support/Log/Handlers/TestHandler.php - - - - message: '#^Method Tests\\Support\\Models\\EventModel\:\:afterDeleteMethod\(\) has parameter \$data with no value type specified in iterable type array\.$#' - count: 1 - path: ../../tests/_support/Models/EventModel.php - - - - message: '#^Method Tests\\Support\\Models\\EventModel\:\:afterFindMethod\(\) has parameter \$data with no value type specified in iterable type array\.$#' - count: 1 - path: ../../tests/_support/Models/EventModel.php - - - - message: '#^Method Tests\\Support\\Models\\EventModel\:\:afterInsertBatchMethod\(\) has parameter \$data with no value type specified in iterable type array\.$#' - count: 1 - path: ../../tests/_support/Models/EventModel.php - - - - message: '#^Method Tests\\Support\\Models\\EventModel\:\:afterInsertMethod\(\) has parameter \$data with no value type specified in iterable type array\.$#' - count: 1 - path: ../../tests/_support/Models/EventModel.php - - - - message: '#^Method Tests\\Support\\Models\\EventModel\:\:afterUpdateBatchMethod\(\) has parameter \$data with no value type specified in iterable type array\.$#' - count: 1 - path: ../../tests/_support/Models/EventModel.php - - - - message: '#^Method Tests\\Support\\Models\\EventModel\:\:afterUpdateMethod\(\) has parameter \$data with no value type specified in iterable type array\.$#' - count: 1 - path: ../../tests/_support/Models/EventModel.php - - - - message: '#^Method Tests\\Support\\Models\\EventModel\:\:beforeDeleteMethod\(\) has parameter \$data with no value type specified in iterable type array\.$#' - count: 1 - path: ../../tests/_support/Models/EventModel.php - - - - message: '#^Method Tests\\Support\\Models\\EventModel\:\:beforeFindMethod\(\) has parameter \$data with no value type specified in iterable type array\.$#' - count: 1 - path: ../../tests/_support/Models/EventModel.php - - - - message: '#^Method Tests\\Support\\Models\\EventModel\:\:beforeInsertBatchMethod\(\) has parameter \$data with no value type specified in iterable type array\.$#' - count: 1 - path: ../../tests/_support/Models/EventModel.php - - - - message: '#^Method Tests\\Support\\Models\\EventModel\:\:beforeInsertMethod\(\) has parameter \$data with no value type specified in iterable type array\.$#' - count: 1 - path: ../../tests/_support/Models/EventModel.php - - - - message: '#^Method Tests\\Support\\Models\\EventModel\:\:beforeUpdateBatchMethod\(\) has parameter \$data with no value type specified in iterable type array\.$#' - count: 1 - path: ../../tests/_support/Models/EventModel.php - - - - message: '#^Method Tests\\Support\\Models\\EventModel\:\:beforeUpdateMethod\(\) has parameter \$data with no value type specified in iterable type array\.$#' - count: 1 - path: ../../tests/_support/Models/EventModel.php - - - - message: '#^Method Tests\\Support\\Validation\\TestRules\:\:check_object_rule\(\) has parameter \$data with no value type specified in iterable type array\.$#' - count: 1 - path: ../../tests/_support/Validation/TestRules.php - - - - message: '#^Property Tests\\Support\\View\\Cells\\ListerCell\:\:\$items type has no value type specified in iterable type array\.$#' - count: 1 - path: ../../tests/_support/View/Cells/ListerCell.php - - message: '#^Method CodeIgniter\\API\\ResponseTraitTest\:\:createRequestAndResponse\(\) has parameter \$userHeaders with no value type specified in iterable type array\.$#' count: 1 diff --git a/utils/phpstan-baseline/missingType.parameter.neon b/utils/phpstan-baseline/missingType.parameter.neon index 7fa258f052cc..687736a425dc 100644 --- a/utils/phpstan-baseline/missingType.parameter.neon +++ b/utils/phpstan-baseline/missingType.parameter.neon @@ -1,4 +1,4 @@ -# total 68 errors +# total 51 errors parameters: ignoreErrors: @@ -27,91 +27,6 @@ parameters: count: 1 path: ../../system/Test/Mock/MockTable.php - - - message: '#^Method Tests\\Support\\Cells\\StarterCell\:\:hello\(\) has parameter \$params with no type specified\.$#' - count: 1 - path: ../../tests/_support/Cells/StarterCell.php - - - - message: '#^Method Tests\\Support\\Controllers\\Newautorouting\:\:postSave\(\) has parameter \$c with no type specified\.$#' - count: 1 - path: ../../tests/_support/Controllers/Newautorouting.php - - - - message: '#^Method Tests\\Support\\Controllers\\Remap\:\:_remap\(\) has parameter \$method with no type specified\.$#' - count: 1 - path: ../../tests/_support/Controllers/Remap.php - - - - message: '#^Method Tests\\Support\\Controllers\\Remap\:\:_remap\(\) has parameter \$params with no type specified\.$#' - count: 1 - path: ../../tests/_support/Controllers/Remap.php - - - - message: '#^Method Tests\\Support\\Test\\TestForReflectionHelper\:\:privateMethod\(\) has parameter \$param1 with no type specified\.$#' - count: 1 - path: ../../tests/_support/Test/TestForReflectionHelper.php - - - - message: '#^Method Tests\\Support\\Test\\TestForReflectionHelper\:\:privateMethod\(\) has parameter \$param2 with no type specified\.$#' - count: 1 - path: ../../tests/_support/Test/TestForReflectionHelper.php - - - - message: '#^Method Tests\\Support\\Test\\TestForReflectionHelper\:\:privateStaticMethod\(\) has parameter \$param1 with no type specified\.$#' - count: 1 - path: ../../tests/_support/Test/TestForReflectionHelper.php - - - - message: '#^Method Tests\\Support\\Test\\TestForReflectionHelper\:\:privateStaticMethod\(\) has parameter \$param2 with no type specified\.$#' - count: 1 - path: ../../tests/_support/Test/TestForReflectionHelper.php - - - - message: '#^Method Tests\\Support\\Validation\\TestRules\:\:array_count\(\) has parameter \$count with no type specified\.$#' - count: 1 - path: ../../tests/_support/Validation/TestRules.php - - - - message: '#^Method Tests\\Support\\Validation\\TestRules\:\:array_count\(\) has parameter \$value with no type specified\.$#' - count: 1 - path: ../../tests/_support/Validation/TestRules.php - - - - message: '#^Method Tests\\Support\\View\\SampleClass\:\:echobox\(\) has parameter \$params with no type specified\.$#' - count: 1 - path: ../../tests/_support/View/SampleClass.php - - - - message: '#^Method Tests\\Support\\View\\SampleClass\:\:staticEcho\(\) has parameter \$params with no type specified\.$#' - count: 1 - path: ../../tests/_support/View/SampleClass.php - - - - message: '#^Method Tests\\Support\\View\\SampleClass\:\:work\(\) has parameter \$p1 with no type specified\.$#' - count: 1 - path: ../../tests/_support/View/SampleClass.php - - - - message: '#^Method Tests\\Support\\View\\SampleClass\:\:work\(\) has parameter \$p2 with no type specified\.$#' - count: 1 - path: ../../tests/_support/View/SampleClass.php - - - - message: '#^Method Tests\\Support\\View\\SampleClass\:\:work\(\) has parameter \$p4 with no type specified\.$#' - count: 1 - path: ../../tests/_support/View/SampleClass.php - - - - message: '#^Method App\\Controllers\\Mycontroller\:\:getSomemethod\(\) has parameter \$first with no type specified\.$#' - count: 1 - path: ../../tests/_support/_controller/Mycontroller.php - - - - message: '#^Method App\\Controllers\\foo\\bar\\baz\\Some_controller\:\:some_method\(\) has parameter \$first with no type specified\.$#' - count: 1 - path: ../../tests/_support/_controller/foo/bar/baz/Some_controller.php - - message: '#^Method class@anonymous/tests/system/API/ResponseTraitTest\.php\:116\:\:__construct\(\) has parameter \$formatter with no type specified\.$#' count: 1 diff --git a/utils/phpstan-baseline/missingType.property.neon b/utils/phpstan-baseline/missingType.property.neon index b4e0a4992eb9..e4842f9f4d25 100644 --- a/utils/phpstan-baseline/missingType.property.neon +++ b/utils/phpstan-baseline/missingType.property.neon @@ -1,4 +1,4 @@ -# total 130 errors +# total 119 errors parameters: ignoreErrors: @@ -87,61 +87,6 @@ parameters: count: 1 path: ../../system/Test/Mock/MockSession.php - - - message: '#^Property Tests\\Support\\Commands\\ParamsReveal\:\:\$args has no type specified\.$#' - count: 1 - path: ../../tests/_support/Commands/ParamsReveal.php - - - - message: '#^Property Tests\\Support\\Config\\Validation\:\:\$signup has no type specified\.$#' - count: 1 - path: ../../tests/_support/Config/Validation.php - - - - message: '#^Property Tests\\Support\\Config\\Validation\:\:\$signup_errors has no type specified\.$#' - count: 1 - path: ../../tests/_support/Config/Validation.php - - - - message: '#^Property Tests\\Support\\Models\\EventModel\:\:\$beforeFindReturnData has no type specified\.$#' - count: 1 - path: ../../tests/_support/Models/EventModel.php - - - - message: '#^Property Tests\\Support\\Models\\EventModel\:\:\$eventData has no type specified\.$#' - count: 1 - path: ../../tests/_support/Models/EventModel.php - - - - message: '#^Property Tests\\Support\\Models\\EventModel\:\:\$tokens has no type specified\.$#' - count: 1 - path: ../../tests/_support/Models/EventModel.php - - - - message: '#^Property Tests\\Support\\Models\\JobModel\:\:\$description has no type specified\.$#' - count: 1 - path: ../../tests/_support/Models/JobModel.php - - - - message: '#^Property Tests\\Support\\Models\\JobModel\:\:\$name has no type specified\.$#' - count: 1 - path: ../../tests/_support/Models/JobModel.php - - - - message: '#^Property Tests\\Support\\Models\\UserModel\:\:\$country has no type specified\.$#' - count: 1 - path: ../../tests/_support/Models/UserModel.php - - - - message: '#^Property Tests\\Support\\Models\\UserModel\:\:\$email has no type specified\.$#' - count: 1 - path: ../../tests/_support/Models/UserModel.php - - - - message: '#^Property Tests\\Support\\Models\\UserModel\:\:\$name has no type specified\.$#' - count: 1 - path: ../../tests/_support/Models/UserModel.php - - message: '#^Property class@anonymous/tests/system/API/ResponseTraitTest\.php\:116\:\:\$formatter has no type specified\.$#' count: 2 diff --git a/utils/phpstan-baseline/missingType.return.neon b/utils/phpstan-baseline/missingType.return.neon index 838443fab4f0..693842b12755 100644 --- a/utils/phpstan-baseline/missingType.return.neon +++ b/utils/phpstan-baseline/missingType.return.neon @@ -1,4 +1,4 @@ -# total 200 errors +# total 150 errors parameters: ignoreErrors: @@ -522,256 +522,6 @@ parameters: count: 1 path: ../../system/Test/PhpStreamWrapper.php - - - message: '#^Method Tests\\Support\\Cells\\StarterCell\:\:hello\(\) has no return type specified\.$#' - count: 1 - path: ../../tests/_support/Cells/StarterCell.php - - - - message: '#^Method Tests\\Support\\Config\\BadRegistrar\:\:RegistrarConfig\(\) has no return type specified\.$#' - count: 1 - path: ../../tests/_support/Config/BadRegistrar.php - - - - message: '#^Method Tests\\Support\\Config\\TestRegistrar\:\:RegistrarConfig\(\) has no return type specified\.$#' - count: 1 - path: ../../tests/_support/Config/TestRegistrar.php - - - - message: '#^Method Tests\\Support\\Controllers\\Hello\:\:index\(\) has no return type specified\.$#' - count: 1 - path: ../../tests/_support/Controllers/Hello.php - - - - message: '#^Method Tests\\Support\\Controllers\\Newautorouting\:\:getIndex\(\) has no return type specified\.$#' - count: 1 - path: ../../tests/_support/Controllers/Newautorouting.php - - - - message: '#^Method Tests\\Support\\Controllers\\Newautorouting\:\:postSave\(\) has no return type specified\.$#' - count: 1 - path: ../../tests/_support/Controllers/Newautorouting.php - - - - message: '#^Method Tests\\Support\\Controllers\\Popcorn\:\:echoJson\(\) has no return type specified\.$#' - count: 1 - path: ../../tests/_support/Controllers/Popcorn.php - - - - message: '#^Method Tests\\Support\\Controllers\\Popcorn\:\:goaway\(\) has no return type specified\.$#' - count: 1 - path: ../../tests/_support/Controllers/Popcorn.php - - - - message: '#^Method Tests\\Support\\Controllers\\Popcorn\:\:index\(\) has no return type specified\.$#' - count: 1 - path: ../../tests/_support/Controllers/Popcorn.php - - - - message: '#^Method Tests\\Support\\Controllers\\Popcorn\:\:index3\(\) has no return type specified\.$#' - count: 1 - path: ../../tests/_support/Controllers/Popcorn.php - - - - message: '#^Method Tests\\Support\\Controllers\\Popcorn\:\:json\(\) has no return type specified\.$#' - count: 1 - path: ../../tests/_support/Controllers/Popcorn.php - - - - message: '#^Method Tests\\Support\\Controllers\\Popcorn\:\:oops\(\) has no return type specified\.$#' - count: 1 - path: ../../tests/_support/Controllers/Popcorn.php - - - - message: '#^Method Tests\\Support\\Controllers\\Popcorn\:\:pop\(\) has no return type specified\.$#' - count: 1 - path: ../../tests/_support/Controllers/Popcorn.php - - - - message: '#^Method Tests\\Support\\Controllers\\Popcorn\:\:toindex\(\) has no return type specified\.$#' - count: 1 - path: ../../tests/_support/Controllers/Popcorn.php - - - - message: '#^Method Tests\\Support\\Controllers\\Popcorn\:\:weasel\(\) has no return type specified\.$#' - count: 1 - path: ../../tests/_support/Controllers/Popcorn.php - - - - message: '#^Method Tests\\Support\\Controllers\\Popcorn\:\:xml\(\) has no return type specified\.$#' - count: 1 - path: ../../tests/_support/Controllers/Popcorn.php - - - - message: '#^Method Tests\\Support\\Controllers\\Remap\:\:_remap\(\) has no return type specified\.$#' - count: 1 - path: ../../tests/_support/Controllers/Remap.php - - - - message: '#^Method Tests\\Support\\Controllers\\Remap\:\:abc\(\) has no return type specified\.$#' - count: 1 - path: ../../tests/_support/Controllers/Remap.php - - - - message: '#^Method Tests\\Support\\Controllers\\Remap\:\:index\(\) has no return type specified\.$#' - count: 1 - path: ../../tests/_support/Controllers/Remap.php - - - - message: '#^Method Tests\\Support\\Entity\\CustomUser\:\:__get\(\) has no return type specified\.$#' - count: 1 - path: ../../tests/_support/Entity/CustomUser.php - - - - message: '#^Method Tests\\Support\\Language\\SecondMockLanguage\:\:loaded\(\) has no return type specified\.$#' - count: 1 - path: ../../tests/_support/Language/SecondMockLanguage.php - - - - message: '#^Method Tests\\Support\\Language\\SecondMockLanguage\:\:loadem\(\) has no return type specified\.$#' - count: 1 - path: ../../tests/_support/Language/SecondMockLanguage.php - - - - message: '#^Method Tests\\Support\\Log\\Handlers\\TestHandler\:\:getLogs\(\) has no return type specified\.$#' - count: 1 - path: ../../tests/_support/Log/Handlers/TestHandler.php - - - - message: '#^Method Tests\\Support\\Models\\EventModel\:\:afterDeleteMethod\(\) has no return type specified\.$#' - count: 1 - path: ../../tests/_support/Models/EventModel.php - - - - message: '#^Method Tests\\Support\\Models\\EventModel\:\:afterFindMethod\(\) has no return type specified\.$#' - count: 1 - path: ../../tests/_support/Models/EventModel.php - - - - message: '#^Method Tests\\Support\\Models\\EventModel\:\:afterInsertBatchMethod\(\) has no return type specified\.$#' - count: 1 - path: ../../tests/_support/Models/EventModel.php - - - - message: '#^Method Tests\\Support\\Models\\EventModel\:\:afterInsertMethod\(\) has no return type specified\.$#' - count: 1 - path: ../../tests/_support/Models/EventModel.php - - - - message: '#^Method Tests\\Support\\Models\\EventModel\:\:afterUpdateBatchMethod\(\) has no return type specified\.$#' - count: 1 - path: ../../tests/_support/Models/EventModel.php - - - - message: '#^Method Tests\\Support\\Models\\EventModel\:\:afterUpdateMethod\(\) has no return type specified\.$#' - count: 1 - path: ../../tests/_support/Models/EventModel.php - - - - message: '#^Method Tests\\Support\\Models\\EventModel\:\:beforeDeleteMethod\(\) has no return type specified\.$#' - count: 1 - path: ../../tests/_support/Models/EventModel.php - - - - message: '#^Method Tests\\Support\\Models\\EventModel\:\:beforeFindMethod\(\) has no return type specified\.$#' - count: 1 - path: ../../tests/_support/Models/EventModel.php - - - - message: '#^Method Tests\\Support\\Models\\EventModel\:\:beforeInsertBatchMethod\(\) has no return type specified\.$#' - count: 1 - path: ../../tests/_support/Models/EventModel.php - - - - message: '#^Method Tests\\Support\\Models\\EventModel\:\:beforeInsertMethod\(\) has no return type specified\.$#' - count: 1 - path: ../../tests/_support/Models/EventModel.php - - - - message: '#^Method Tests\\Support\\Models\\EventModel\:\:beforeUpdateBatchMethod\(\) has no return type specified\.$#' - count: 1 - path: ../../tests/_support/Models/EventModel.php - - - - message: '#^Method Tests\\Support\\Models\\EventModel\:\:beforeUpdateMethod\(\) has no return type specified\.$#' - count: 1 - path: ../../tests/_support/Models/EventModel.php - - - - message: '#^Method Tests\\Support\\Models\\EventModel\:\:hasToken\(\) has no return type specified\.$#' - count: 1 - path: ../../tests/_support/Models/EventModel.php - - - - message: '#^Method Tests\\Support\\Test\\TestForReflectionHelper\:\:getPrivate\(\) has no return type specified\.$#' - count: 1 - path: ../../tests/_support/Test/TestForReflectionHelper.php - - - - message: '#^Method Tests\\Support\\Test\\TestForReflectionHelper\:\:getStaticPrivate\(\) has no return type specified\.$#' - count: 1 - path: ../../tests/_support/Test/TestForReflectionHelper.php - - - - message: '#^Method Tests\\Support\\Test\\TestForReflectionHelper\:\:privateMethod\(\) has no return type specified\.$#' - count: 1 - path: ../../tests/_support/Test/TestForReflectionHelper.php - - - - message: '#^Method Tests\\Support\\Test\\TestForReflectionHelper\:\:privateStaticMethod\(\) has no return type specified\.$#' - count: 1 - path: ../../tests/_support/Test/TestForReflectionHelper.php - - - - message: '#^Method Tests\\Support\\Validation\\TestRules\:\:check_object_rule\(\) has no return type specified\.$#' - count: 1 - path: ../../tests/_support/Validation/TestRules.php - - - - message: '#^Method Tests\\Support\\Validation\\TestRules\:\:customError\(\) has no return type specified\.$#' - count: 1 - path: ../../tests/_support/Validation/TestRules.php - - - - message: '#^Method Tests\\Support\\View\\Cells\\ListerCell\:\:getItemsProperty\(\) has no return type specified\.$#' - count: 1 - path: ../../tests/_support/View/Cells/ListerCell.php - - - - message: '#^Method Tests\\Support\\View\\OtherCells\\SampleClass\:\:hello\(\) has no return type specified\.$#' - count: 1 - path: ../../tests/_support/View/OtherCells/SampleClass.php - - - - message: '#^Method Tests\\Support\\View\\SampleClass\:\:echobox\(\) has no return type specified\.$#' - count: 1 - path: ../../tests/_support/View/SampleClass.php - - - - message: '#^Method Tests\\Support\\View\\SampleClass\:\:hello\(\) has no return type specified\.$#' - count: 1 - path: ../../tests/_support/View/SampleClass.php - - - - message: '#^Method Tests\\Support\\View\\SampleClass\:\:index\(\) has no return type specified\.$#' - count: 1 - path: ../../tests/_support/View/SampleClass.php - - - - message: '#^Method Tests\\Support\\View\\SampleClass\:\:staticEcho\(\) has no return type specified\.$#' - count: 1 - path: ../../tests/_support/View/SampleClass.php - - - - message: '#^Method Tests\\Support\\View\\SampleClass\:\:work\(\) has no return type specified\.$#' - count: 1 - path: ../../tests/_support/View/SampleClass.php - - - - message: '#^Method Tests\\Support\\View\\SampleClassWithInitController\:\:index\(\) has no return type specified\.$#' - count: 1 - path: ../../tests/_support/View/SampleClassWithInitController.php - - message: '#^Method CodeIgniter\\API\\ResponseTraitTest\:\:invoke\(\) has no return type specified\.$#' count: 1 diff --git a/utils/phpstan-baseline/property.defaultValue.neon b/utils/phpstan-baseline/property.defaultValue.neon index 8e8914167fe2..21d5acab00f2 100644 --- a/utils/phpstan-baseline/property.defaultValue.neon +++ b/utils/phpstan-baseline/property.defaultValue.neon @@ -1,4 +1,4 @@ -# total 6 errors +# total 4 errors parameters: ignoreErrors: @@ -12,16 +12,6 @@ parameters: count: 1 path: ../../system/Test/CIUnitTestCase.php - - - message: '#^Property Tests\\Support\\Models\\ValidErrorsModel\:\:\$validationRules \(array\\|string\>\|string\>\|string\) does not accept default value of type array\\|string\>\|string\>\.$#' - count: 1 - path: ../../tests/_support/Models/ValidErrorsModel.php - - - - message: '#^Property Tests\\Support\\Models\\ValidModel\:\:\$validationRules \(array\\|string\>\|string\>\|string\) does not accept default value of type array\\|string\>\.$#' - count: 1 - path: ../../tests/_support/Models/ValidModel.php - - message: '#^Property CodeIgniter\\Models\\DataConverterModelTest\:\:\$seed \(class\-string\\|list\\>\) does not accept default value of type ''''\.$#' count: 1 diff --git a/utils/phpstan-baseline/ternary.shortNotAllowed.neon b/utils/phpstan-baseline/ternary.shortNotAllowed.neon index 8fbe74a182db..a04074775f2e 100644 --- a/utils/phpstan-baseline/ternary.shortNotAllowed.neon +++ b/utils/phpstan-baseline/ternary.shortNotAllowed.neon @@ -1,4 +1,4 @@ -# total 37 errors +# total 36 errors parameters: ignoreErrors: @@ -97,11 +97,6 @@ parameters: count: 2 path: ../../system/View/View.php - - - message: '#^Short ternary operator is not allowed\. Use null coalesce operator if applicable or consider using long ternary\.$#' - count: 1 - path: ../../tests/_support/Commands/LanguageCommand.php - - message: '#^Short ternary operator is not allowed\. Use null coalesce operator if applicable or consider using long ternary\.$#' count: 1 diff --git a/utils/phpstan-baseline/variable.undefined.neon b/utils/phpstan-baseline/variable.undefined.neon deleted file mode 100644 index 00aea3030994..000000000000 --- a/utils/phpstan-baseline/variable.undefined.neon +++ /dev/null @@ -1,78 +0,0 @@ -# total 21 errors - -parameters: - ignoreErrors: - - - message: '#^Variable \$result might not be defined\.$#' - count: 1 - path: ../../system/Cache/Handlers/FileHandler.php - - - - message: '#^Variable \$result might not be defined\.$#' - count: 1 - path: ../../system/Helpers/filesystem_helper.php - - - - message: '#^Variable \$written might not be defined\.$#' - count: 1 - path: ../../system/Session/Handlers/FileHandler.php - - - - message: '#^Variable \$filters might not be defined\.$#' - count: 2 - path: ../../tests/_support/Config/Filters.php - - - - message: '#^Variable \$routes might not be defined\.$#' - count: 5 - path: ../../tests/_support/Config/Routes.php - - - - message: '#^Variable \$value might not be defined\.$#' - count: 1 - path: ../../tests/_support/View/Cells/addition.php - - - - message: '#^Variable \$message might not be defined\.$#' - count: 1 - path: ../../tests/_support/View/Cells/awesome_cell.php - - - - message: '#^Variable \$this might not be defined\.$#' - count: 1 - path: ../../tests/_support/View/Cells/colors.php - - - - message: '#^Variable \$greeting might not be defined\.$#' - count: 1 - path: ../../tests/_support/View/Cells/greeting.php - - - - message: '#^Variable \$name might not be defined\.$#' - count: 1 - path: ../../tests/_support/View/Cells/greeting.php - - - - message: '#^Variable \$items might not be defined\.$#' - count: 1 - path: ../../tests/_support/View/Cells/lister.php - - - - message: '#^Variable \$value might not be defined\.$#' - count: 1 - path: ../../tests/_support/View/Cells/multiplier.php - - - - message: '#^Variable \$message might not be defined\.$#' - count: 1 - path: ../../tests/_support/View/Cells/notice.php - - - - message: '#^Variable \$testString might not be defined\.$#' - count: 1 - path: ../../tests/_support/View/Views/simple.php - - - - message: '#^Variable \$result might not be defined\.$#' - count: 2 - path: ../../tests/system/Test/FilterTestTraitTest.php