From 394bb07a734bd0e24df9054c0101e55626adf18b Mon Sep 17 00:00:00 2001 From: "John Paul E. Balandan, CPA" Date: Thu, 9 Jul 2026 02:53:48 +0800 Subject: [PATCH] refactor: use `array-key` as the benevolent union of `int|string` in array shapes --- system/API/TransformerInterface.php | 2 +- system/BaseModel.php | 4 ++-- system/CLI/BaseCommand.php | 4 ++-- system/CLI/CLI.php | 24 +++++++++---------- system/CLI/Commands.php | 2 +- system/CLI/Console.php | 4 ++-- system/CLI/GeneratorTrait.php | 10 ++++---- system/Commands/Database/MigrateRefresh.php | 2 +- system/Commands/Database/MigrateStatus.php | 2 -- system/Commands/Encryption/GenerateKey.php | 4 ++-- system/Commands/Utilities/FilterCheck.php | 2 +- system/Common.php | 14 +++++------ system/Config/BaseConfig.php | 2 +- system/Database/BaseBuilder.php | 2 +- system/Database/BaseConnection.php | 2 +- system/Database/ConnectionInterface.php | 2 +- system/Database/OCI8/Builder.php | 2 +- system/Database/Postgre/Builder.php | 2 +- system/Database/SQLSRV/Builder.php | 2 +- system/Encryption/Handlers/BaseHandler.php | 2 +- system/Encryption/KeyRotationDecorator.php | 2 +- system/Entity/Entity.php | 2 +- system/HTTP/Header.php | 10 ++++---- system/HTTP/IncomingRequest.php | 6 ++--- system/I18n/TimeTrait.php | 2 +- system/Model.php | 4 ++-- system/Test/CIUnitTestCase.php | 4 ++-- system/Test/DatabaseTestTrait.php | 10 ++++---- system/Test/FeatureTestTrait.php | 4 ++-- system/Test/Mock/MockConnection.php | 2 +- system/View/Parser.php | 2 +- system/View/Plugins.php | 2 +- tests/system/HTTP/HeaderTest.php | 6 ++--- .../system/Validation/CreditCardRulesTest.php | 2 +- tests/system/Validation/FileRulesTest.php | 2 +- tests/system/Validation/FormatRulesTest.php | 2 +- tests/system/Validation/RulesTest.php | 2 +- .../StrictRules/CreditCardRulesTest.php | 2 +- .../Validation/StrictRules/FileRulesTest.php | 2 +- .../StrictRules/FormatRulesTest.php | 2 +- .../Validation/StrictRules/RulesTest.php | 2 +- .../Validation/StrictRules/ValidationTest.php | 2 +- tests/system/Validation/ValidationTest.php | 2 +- utils/phpstan-baseline/argument.type.neon | 22 +---------------- utils/phpstan-baseline/loader.neon | 2 +- .../method.childParameterType.neon | 7 +----- 46 files changed, 85 insertions(+), 112 deletions(-) diff --git a/system/API/TransformerInterface.php b/system/API/TransformerInterface.php index 3d994251b302..7f8dd95759db 100644 --- a/system/API/TransformerInterface.php +++ b/system/API/TransformerInterface.php @@ -43,7 +43,7 @@ public function transform(array|object|null $resource): array; /** * Transforms a collection of resources using $this->transform() on each item. * - * @param array $resources + * @param array $resources * * @return array> */ diff --git a/system/BaseModel.php b/system/BaseModel.php index 6f52c02a48c6..5579bd8f810a 100644 --- a/system/BaseModel.php +++ b/system/BaseModel.php @@ -1855,7 +1855,7 @@ protected function objectToRawArray($object, bool $onlyChanged = true, bool $rec * * @param object|row_array|null $row * - * @return array + * @return array * * @throws DataException * @throws InvalidArgumentException @@ -1947,7 +1947,7 @@ public function __isset(string $name): bool /** * Provides direct access to method in the database connection. * - * @param array $params + * @param array $params * * @return mixed */ diff --git a/system/CLI/BaseCommand.php b/system/CLI/BaseCommand.php index 57df52d47f55..72769dfd85a9 100644 --- a/system/CLI/BaseCommand.php +++ b/system/CLI/BaseCommand.php @@ -99,7 +99,7 @@ public function __construct(LoggerInterface $logger, Commands $commands) /** * Actually execute a command. * - * @param array $params + * @param array $params * * @return int|void */ @@ -108,7 +108,7 @@ abstract public function run(array $params); /** * Can be used by a command to run other commands. * - * @param array $params + * @param array $params * * @return int|void * diff --git a/system/CLI/CLI.php b/system/CLI/CLI.php index 11f49bbc0c45..10e39cee0ad4 100644 --- a/system/CLI/CLI.php +++ b/system/CLI/CLI.php @@ -273,10 +273,10 @@ public static function prompt(string $field, $options = null, $validation = null /** * prompt(), but based on the option's key * - * @param list|string $text Output "field" text or an one or two value array where the first value is the text before listing the options - * and the second value the text before asking to select one option. Provide empty string to omit - * @param array $options A list of options (array(key => description)), the first option will be the default value - * @param list|string|null $validation Validation rules + * @param list|string $text Output "field" text or an one or two value array where the first value is the text before listing the options + * and the second value the text before asking to select one option. Provide empty string to omit + * @param array $options A list of options (array(key => description)), the first option will be the default value + * @param list|string|null $validation Validation rules * * @return string The selected key of $options */ @@ -302,11 +302,11 @@ public static function promptByKey($text, array $options, $validation = null): s /** * This method is the same as promptByKey(), but this method supports multiple keys, separated by commas. * - * @param string $text Output "field" text or an one or two value array where the first value is the text before listing the options - * and the second value the text before asking to select one option. Provide empty string to omit - * @param array $options A list of options (array(key => description)), the first option will be the default value + * @param string $text Output "field" text or an one or two value array where the first value is the text before listing the options + * and the second value the text before asking to select one option. Provide empty string to omit + * @param array $options A list of options (array(key => description)), the first option will be the default value * - * @return array The selected key(s) and value(s) of $options + * @return array The selected key(s) and value(s) of $options */ public static function promptByMultipleKeys(string $text, array $options): array { @@ -376,7 +376,7 @@ public static function promptByMultipleKeys(string $text, array $options): array /** * Validation for $options in promptByKey() and promptByMultipleKeys(). Return an error if $options is an empty array. * - * @param array $options + * @param array $options */ private static function isZeroOptions(array $options): void { @@ -388,7 +388,7 @@ private static function isZeroOptions(array $options): void /** * Print each key and value one by one * - * @param array $options + * @param array $options */ private static function printKeysAndValues(array $options): void { @@ -1029,8 +1029,8 @@ public static function getOptionString(bool $useLongOpts = false, bool $trim = f /** * Returns a well formatted table * - * @param list> $tbody List of rows - * @param list $thead List of columns + * @param list> $tbody List of rows + * @param list $thead List of columns * * @return void */ diff --git a/system/CLI/Commands.php b/system/CLI/Commands.php index 8f623d509c0a..bbccf6525f15 100644 --- a/system/CLI/Commands.php +++ b/system/CLI/Commands.php @@ -54,7 +54,7 @@ public function __construct($logger = null) /** * Runs a command given * - * @param array $params + * @param array $params * * @return int Exit code */ diff --git a/system/CLI/Console.php b/system/CLI/Console.php index b24562e52d46..82c31d60f7c5 100644 --- a/system/CLI/Console.php +++ b/system/CLI/Console.php @@ -74,9 +74,9 @@ public function showHeader(bool $suppress = false) * We'll remove that as an option from `$params` and * unshift it as argument instead. * - * @param array $params + * @param array $params * - * @return array + * @return array */ private function parseParamsForHelpOption(array $params): array { diff --git a/system/CLI/GeneratorTrait.php b/system/CLI/GeneratorTrait.php index 7d66b8b290af..45e72c7bda71 100644 --- a/system/CLI/GeneratorTrait.php +++ b/system/CLI/GeneratorTrait.php @@ -96,14 +96,14 @@ trait GeneratorTrait * * @internal * - * @var array + * @var array */ private $params = []; /** * Execute the command. * - * @param array $params + * @param array $params * * @deprecated use generateClass() instead */ @@ -115,7 +115,7 @@ protected function execute(array $params): void /** * Generates a class file from an existing template. * - * @param array $params + * @param array $params */ protected function generateClass(array $params): void { @@ -138,8 +138,8 @@ protected function generateClass(array $params): void /** * Generate a view file from an existing template. * - * @param string $view namespaced view name that is generated - * @param array $params + * @param string $view namespaced view name that is generated + * @param array $params */ protected function generateView(string $view, array $params): void { diff --git a/system/Commands/Database/MigrateRefresh.php b/system/Commands/Database/MigrateRefresh.php index b7863a001438..9ee39af58f1e 100644 --- a/system/Commands/Database/MigrateRefresh.php +++ b/system/Commands/Database/MigrateRefresh.php @@ -72,7 +72,7 @@ class MigrateRefresh extends BaseCommand */ public function run(array $params) { - $params['b'] = 0; + $params['b'] = '0'; if (ENVIRONMENT === 'production') { // @codeCoverageIgnoreStart diff --git a/system/Commands/Database/MigrateStatus.php b/system/Commands/Database/MigrateStatus.php index 9506c2eae082..68288353458d 100644 --- a/system/Commands/Database/MigrateStatus.php +++ b/system/Commands/Database/MigrateStatus.php @@ -77,8 +77,6 @@ class MigrateStatus extends BaseCommand /** * Displays a list of all migrations and whether they've been run or not. - * - * @param array $params */ public function run(array $params) { diff --git a/system/Commands/Encryption/GenerateKey.php b/system/Commands/Encryption/GenerateKey.php index 148fd264dc33..33858e5ab4c1 100644 --- a/system/Commands/Encryption/GenerateKey.php +++ b/system/Commands/Encryption/GenerateKey.php @@ -127,7 +127,7 @@ protected function generateRandomKey(string $prefix, int $length): string /** * Sets the new encryption key in your .env file. * - * @param array $params + * @param array $params */ protected function setNewEncryptionKey(string $key, array $params): bool { @@ -144,7 +144,7 @@ protected function setNewEncryptionKey(string $key, array $params): bool /** * Checks whether to overwrite existing encryption key. * - * @param array $params + * @param array $params */ protected function confirmOverwrite(array $params): bool { diff --git a/system/Commands/Utilities/FilterCheck.php b/system/Commands/Utilities/FilterCheck.php index e2043fe9a3a4..5013b7ddf054 100644 --- a/system/Commands/Utilities/FilterCheck.php +++ b/system/Commands/Utilities/FilterCheck.php @@ -108,7 +108,7 @@ public function run(array $params) } /** - * @param array $params + * @param array $params */ private function checkParams(array $params): bool { diff --git a/system/Common.php b/system/Common.php index fc8abb394f06..d99b4ef3ca3c 100644 --- a/system/Common.php +++ b/system/Common.php @@ -154,7 +154,7 @@ function command(string $command) $cursor += strlen($match[0]); } - /** @var array */ + /** @var array */ $params = []; $command = array_shift($args); $optionValue = false; @@ -450,13 +450,13 @@ function env(string $key, $default = null) * If $data is an array, then it loops over it, escaping each * 'value' of the key/value pairs. * - * @param array|string>|string $data - * @param 'attr'|'css'|'html'|'js'|'raw'|'url' $context - * @param string|null $encoding Current encoding for escaping. - * If not UTF-8, we convert strings from this encoding - * pre-escaping and back to this encoding post-escaping. + * @param array|string>|string $data + * @param 'attr'|'css'|'html'|'js'|'raw'|'url' $context + * @param string|null $encoding Current encoding for escaping. + * If not UTF-8, we convert strings from this encoding + * pre-escaping and back to this encoding post-escaping. * - * @return ($data is string ? string : array|string>) + * @return ($data is string ? string : array|string>) * * @throws InvalidArgumentException */ diff --git a/system/Config/BaseConfig.php b/system/Config/BaseConfig.php index 40782a243b96..baa030ed7b5c 100644 --- a/system/Config/BaseConfig.php +++ b/system/Config/BaseConfig.php @@ -166,7 +166,7 @@ protected function parseEncryptionKey(string $key): string /** * Initialization an environment-specific configuration setting * - * @param array|bool|float|int|string|null $property + * @param array|bool|float|int|string|null $property * * @return void */ diff --git a/system/Database/BaseBuilder.php b/system/Database/BaseBuilder.php index 3989b9a2d011..c3ed39102ae6 100644 --- a/system/Database/BaseBuilder.php +++ b/system/Database/BaseBuilder.php @@ -2813,7 +2813,7 @@ public function getCompiledDelete(bool $reset = true): string /** * Compiles a delete string and runs the query * - * @param array|RawSql|string $where + * @param array|RawSql|string $where * * @return bool|string Returns a SQL string if in test mode. * diff --git a/system/Database/BaseConnection.php b/system/Database/BaseConnection.php index c0cb7174dd52..17a5775d425f 100644 --- a/system/Database/BaseConnection.php +++ b/system/Database/BaseConnection.php @@ -781,7 +781,7 @@ abstract protected function execute(string $sql); * Should automatically handle different connections for read/write * queries if needed. * - * @param array|string|null $binds + * @param array|string|null $binds * * @return BaseResult|bool|Query * diff --git a/system/Database/ConnectionInterface.php b/system/Database/ConnectionInterface.php index 15fd63e1c7aa..d1206155125c 100644 --- a/system/Database/ConnectionInterface.php +++ b/system/Database/ConnectionInterface.php @@ -100,7 +100,7 @@ public function getVersion(): string; * Should automatically handle different connections for read/write * queries if needed. * - * @param array|string|null $binds + * @param array|string|null $binds * * @return BaseResult|bool|Query */ diff --git a/system/Database/OCI8/Builder.php b/system/Database/OCI8/Builder.php index ff5b1289c34a..d1abead5060a 100644 --- a/system/Database/OCI8/Builder.php +++ b/system/Database/OCI8/Builder.php @@ -150,7 +150,7 @@ protected function _truncate(string $table): string /** * Compiles a delete string and runs the query * - * @param array|RawSql|string $where + * @param array|RawSql|string $where * * @return bool|string * diff --git a/system/Database/Postgre/Builder.php b/system/Database/Postgre/Builder.php index c3a673558ec8..68cd00fb6246 100644 --- a/system/Database/Postgre/Builder.php +++ b/system/Database/Postgre/Builder.php @@ -225,7 +225,7 @@ protected function _insertBatch(string $table, array $keys, array $values): stri /** * Compiles a delete string and runs the query * - * @param array|RawSql|string $where + * @param array|RawSql|string $where * * @return bool|string * diff --git a/system/Database/SQLSRV/Builder.php b/system/Database/SQLSRV/Builder.php index cd7e7968fe72..486b30c3a6b9 100644 --- a/system/Database/SQLSRV/Builder.php +++ b/system/Database/SQLSRV/Builder.php @@ -538,7 +538,7 @@ protected function _delete(string $table): string /** * Compiles a delete string and runs the query * - * @param array|RawSql|string $where + * @param array|RawSql|string $where * * @return bool|string * diff --git a/system/Encryption/Handlers/BaseHandler.php b/system/Encryption/Handlers/BaseHandler.php index c324a465dbb8..0f0627c654d6 100644 --- a/system/Encryption/Handlers/BaseHandler.php +++ b/system/Encryption/Handlers/BaseHandler.php @@ -55,7 +55,7 @@ protected static function substr($str, $start, $length = null) * * @param string $key Property name * - * @return array|bool|int|string|null + * @return array|bool|int|string|null */ public function __get($key) { diff --git a/system/Encryption/KeyRotationDecorator.php b/system/Encryption/KeyRotationDecorator.php index 9e4b6ef0002b..7202bcc06764 100644 --- a/system/Encryption/KeyRotationDecorator.php +++ b/system/Encryption/KeyRotationDecorator.php @@ -86,7 +86,7 @@ public function decrypt($data, #[SensitiveParameter] $params = null) /** * Delegate property access to the inner handler. * - * @return array|bool|int|string|null + * @return array|bool|int|string|null */ public function __get(string $key) { diff --git a/system/Entity/Entity.php b/system/Entity/Entity.php index 95261f607458..a67c44b6fd1c 100644 --- a/system/Entity/Entity.php +++ b/system/Entity/Entity.php @@ -421,7 +421,7 @@ public function hasChanged(?string $key = null): bool * Checks if an array contains only Entity instances. * This allows optimization for per-entity change tracking. * - * @param array $data + * @param array $data */ private function containsOnlyEntities(array $data): bool { diff --git a/system/HTTP/Header.php b/system/HTTP/Header.php index a21f9961536a..54f162eb7caa 100644 --- a/system/HTTP/Header.php +++ b/system/HTTP/Header.php @@ -44,14 +44,14 @@ class Header implements Stringable * 'baz' => 'buzz', * ] * - * @var array|string>|string + * @var array|string>|string */ protected $value; /** * Header constructor. name is mandatory, if a value is provided, it will be set. * - * @param array|string>|string|null $value + * @param array|string>|int|string|null $value */ public function __construct(string $name, $value = null) { @@ -71,7 +71,7 @@ public function getName(): string * Gets the raw value of the header. This may return either a string * or an array, depending on whether the header has multiple values or not. * - * @return array|string>|string + * @return array|string>|string */ public function getValue() { @@ -96,7 +96,7 @@ public function setName(string $name) /** * Sets the value of the header, overwriting any previous value(s). * - * @param array|string>|string|null $value + * @param array|int|string>|int|string|null $value * * @return $this * @@ -235,7 +235,7 @@ private function validateName(string $name): void * * @see https://datatracker.ietf.org/doc/html/rfc7230#section-3.2 * - * @param array|string>|int|string $value + * @param array|int|string>|int|string $value * * @throws InvalidArgumentException */ diff --git a/system/HTTP/IncomingRequest.php b/system/HTTP/IncomingRequest.php index 3a43d6dec050..c980810b9b2b 100644 --- a/system/HTTP/IncomingRequest.php +++ b/system/HTTP/IncomingRequest.php @@ -367,7 +367,7 @@ public function getDefaultLocale(): string * @param int|null $filter Filter constant * @param array|int|null $flags * - * @return array|bool|float|int|stdClass|string|null + * @return array|bool|float|int|stdClass|string|null */ public function getVar($index = null, $filter = null, $flags = null) { @@ -394,7 +394,7 @@ public function getVar($index = null, $filter = null, $flags = null) * * @see http://php.net/manual/en/function.json-decode.php * - * @return array|bool|float|int|stdClass|null + * @return array|bool|float|int|stdClass|null * * @throws HTTPException When the body is invalid as JSON. */ @@ -421,7 +421,7 @@ public function getJSON(bool $assoc = false, int $depth = 512, int $options = 0) * @param int|null $filter Filter Constant * @param array|int|null $flags Option * - * @return array|bool|float|int|stdClass|string|null + * @return array|bool|float|int|stdClass|string|null */ public function getJsonVar($index = null, bool $assoc = false, ?int $filter = null, $flags = null) { diff --git a/system/I18n/TimeTrait.php b/system/I18n/TimeTrait.php index 04499668f5ed..3c76f117f99e 100644 --- a/system/I18n/TimeTrait.php +++ b/system/I18n/TimeTrait.php @@ -1211,7 +1211,7 @@ public function __toString(): string * * @param string $name * - * @return array|bool|DateTimeInterface|DateTimeZone|int|IntlCalendar|self|string|null + * @return array|bool|DateTimeInterface|DateTimeZone|int|IntlCalendar|self|string|null */ public function __get($name) { diff --git a/system/Model.php b/system/Model.php index 0d3c55ee0568..ccade9cfb700 100644 --- a/system/Model.php +++ b/system/Model.php @@ -123,7 +123,7 @@ class Model extends BaseModel * so that we can capture it (not the builder) * and ensure it gets validated first. * - * @var array{escape: array, data: row_array}|array{} + * @var array{escape: array, data: row_array}|array{} */ protected $tempData = []; @@ -131,7 +131,7 @@ class Model extends BaseModel * Escape array that maps usage of escape * flag for every parameter. * - * @var array + * @var array */ protected $escape = []; diff --git a/system/Test/CIUnitTestCase.php b/system/Test/CIUnitTestCase.php index edfa98df5c06..92b5d8631bf2 100644 --- a/system/Test/CIUnitTestCase.php +++ b/system/Test/CIUnitTestCase.php @@ -169,7 +169,7 @@ abstract class CIUnitTestCase extends TestCase * Stores information needed to remove any * rows inserted via $this->hasInDatabase(). * - * @var list> + * @var list> */ protected $insertCache = []; @@ -189,7 +189,7 @@ abstract class CIUnitTestCase extends TestCase * Values to be set in the SESSION global * before running the test. * - * @var array + * @var array */ protected $session = []; diff --git a/system/Test/DatabaseTestTrait.php b/system/Test/DatabaseTestTrait.php index 14c47c95cee7..af2a1679328d 100644 --- a/system/Test/DatabaseTestTrait.php +++ b/system/Test/DatabaseTestTrait.php @@ -29,11 +29,11 @@ * Provides functionality for refreshing/seeding * the database during testing. * - * @property BaseConnection $db - * @property list> $insertCache - * @property Seeder|null $seeder - * @property MigrationRunner|null $migrations - * @property list|string|null $namespace + * @property BaseConnection $db + * @property list> $insertCache + * @property Seeder|null $seeder + * @property MigrationRunner|null $migrations + * @property list|string|null $namespace * * @mixin CIUnitTestCase */ diff --git a/system/Test/FeatureTestTrait.php b/system/Test/FeatureTestTrait.php index 087fc0a59d90..db298084e023 100644 --- a/system/Test/FeatureTestTrait.php +++ b/system/Test/FeatureTestTrait.php @@ -35,7 +35,7 @@ * Provides additional utilities for doing full HTTP testing * against your application in trait format. * - * @property array $session + * @property array $session * @property array|string> $headers * @property RouteCollection|null $routes * @@ -104,7 +104,7 @@ protected function withRoutes(?array $routes = null) /** * Sets any values that should exist during this session. * - * @param array|null $values Array of values, or null to use the current $_SESSION + * @param array|null $values Array of values, or null to use the current $_SESSION * * @return $this */ diff --git a/system/Test/Mock/MockConnection.php b/system/Test/Mock/MockConnection.php index 7f6aa5240e27..0db8aec916d5 100644 --- a/system/Test/Mock/MockConnection.php +++ b/system/Test/Mock/MockConnection.php @@ -70,7 +70,7 @@ public function shouldReturn(string $method, $return) * Should automatically handle different connections for read/write * queries if needed. * - * @param array|string|null $binds + * @param array|string|null $binds * * @return BaseResult|bool|Query * diff --git a/system/View/Parser.php b/system/View/Parser.php index 5de115f8236b..af4ebea346ac 100644 --- a/system/View/Parser.php +++ b/system/View/Parser.php @@ -721,7 +721,7 @@ protected function parsePlugins(string $template) /** * Makes a new plugin available during the parsing of the template. * - * @param (callable(array): string)|(callable(string, array): string) $callback + * @param (callable(array): string)|(callable(string, array): string) $callback * * @return $this */ diff --git a/system/View/Plugins.php b/system/View/Plugins.php index 7142e44c452e..b546b4a991d8 100644 --- a/system/View/Plugins.php +++ b/system/View/Plugins.php @@ -71,7 +71,7 @@ public static function safeMailto(array $params = []): string /** * Wrap helper function to use as view plugin. * - * @param array|list $params + * @param array|list $params */ public static function lang(array $params = []): string { diff --git a/tests/system/HTTP/HeaderTest.php b/tests/system/HTTP/HeaderTest.php index b7a1eff0e150..3d79da95f09b 100644 --- a/tests/system/HTTP/HeaderTest.php +++ b/tests/system/HTTP/HeaderTest.php @@ -67,7 +67,7 @@ public function testHeaderStoresBasicWithObject(): void $name = 'foo'; $value = new stdClass(); - new Header($name, $value); + new Header($name, $value); // @phpstan-ignore argument.type } public function testHeaderStoresArrayValues(): void @@ -275,7 +275,7 @@ public static function provideInvalidHeaderNames(): iterable } /** - * @param array|string>|string|null $value + * @param array|string>|string|null $value */ #[DataProvider('provideInvalidHeaderValues')] public function testInvalidHeaderValues($value): void @@ -286,7 +286,7 @@ public function testInvalidHeaderValues($value): void } /** - * @return list|string>> + * @return list|string>> */ public static function provideInvalidHeaderValues(): iterable { diff --git a/tests/system/Validation/CreditCardRulesTest.php b/tests/system/Validation/CreditCardRulesTest.php index e578c0b4d980..50c0bfecf50c 100644 --- a/tests/system/Validation/CreditCardRulesTest.php +++ b/tests/system/Validation/CreditCardRulesTest.php @@ -26,7 +26,7 @@ final class CreditCardRulesTest extends StrictCreditCardRulesTest protected Validation $validation; /** - * @var array|string>> + * @var array|string>> */ protected array $config = [ 'ruleSets' => [ diff --git a/tests/system/Validation/FileRulesTest.php b/tests/system/Validation/FileRulesTest.php index 2b43768e1ac8..a5153cd26868 100644 --- a/tests/system/Validation/FileRulesTest.php +++ b/tests/system/Validation/FileRulesTest.php @@ -26,7 +26,7 @@ final class FileRulesTest extends StrictFileRulesTest protected Validation $validation; /** - * @var array|string>> + * @var array|string>> */ protected array $config = [ 'ruleSets' => [ diff --git a/tests/system/Validation/FormatRulesTest.php b/tests/system/Validation/FormatRulesTest.php index b7d369e754a2..d35855865e05 100644 --- a/tests/system/Validation/FormatRulesTest.php +++ b/tests/system/Validation/FormatRulesTest.php @@ -33,7 +33,7 @@ class FormatRulesTest extends CIUnitTestCase protected Validation $validation; /** - * @var array|string>> + * @var array|string>> */ protected array $config = [ 'ruleSets' => [ diff --git a/tests/system/Validation/RulesTest.php b/tests/system/Validation/RulesTest.php index 288a6d247e50..deddab05dc4d 100644 --- a/tests/system/Validation/RulesTest.php +++ b/tests/system/Validation/RulesTest.php @@ -31,7 +31,7 @@ class RulesTest extends CIUnitTestCase protected Validation $validation; /** - * @var array|string>> + * @var array|string>> */ protected array $config = [ 'ruleSets' => [ diff --git a/tests/system/Validation/StrictRules/CreditCardRulesTest.php b/tests/system/Validation/StrictRules/CreditCardRulesTest.php index a1bc09aa6c0f..21691ebd6fae 100644 --- a/tests/system/Validation/StrictRules/CreditCardRulesTest.php +++ b/tests/system/Validation/StrictRules/CreditCardRulesTest.php @@ -30,7 +30,7 @@ class CreditCardRulesTest extends CIUnitTestCase protected Validation $validation; /** - * @var array|string>> + * @var array|string>> */ protected array $config = [ 'ruleSets' => [ diff --git a/tests/system/Validation/StrictRules/FileRulesTest.php b/tests/system/Validation/StrictRules/FileRulesTest.php index 5c58787b5f0b..da96b9f0c556 100644 --- a/tests/system/Validation/StrictRules/FileRulesTest.php +++ b/tests/system/Validation/StrictRules/FileRulesTest.php @@ -30,7 +30,7 @@ class FileRulesTest extends CIUnitTestCase protected Validation $validation; /** - * @var array|string>> + * @var array|string>> */ protected array $config = [ 'ruleSets' => [ diff --git a/tests/system/Validation/StrictRules/FormatRulesTest.php b/tests/system/Validation/StrictRules/FormatRulesTest.php index 92d12ad8ad1a..db7372d8179c 100644 --- a/tests/system/Validation/StrictRules/FormatRulesTest.php +++ b/tests/system/Validation/StrictRules/FormatRulesTest.php @@ -24,7 +24,7 @@ final class FormatRulesTest extends TraditionalFormatRulesTest { /** - * @var array|string>> + * @var array|string>> */ protected array $config = [ 'ruleSets' => [ diff --git a/tests/system/Validation/StrictRules/RulesTest.php b/tests/system/Validation/StrictRules/RulesTest.php index fc9a771715c8..0fc4f9e38c6e 100644 --- a/tests/system/Validation/StrictRules/RulesTest.php +++ b/tests/system/Validation/StrictRules/RulesTest.php @@ -28,7 +28,7 @@ final class RulesTest extends TraditionalRulesTest protected Validation $validation; /** - * @var array|string>> + * @var array|string>> */ protected array $config = [ 'ruleSets' => [ diff --git a/tests/system/Validation/StrictRules/ValidationTest.php b/tests/system/Validation/StrictRules/ValidationTest.php index 9473cd9f6b32..afff6c8f6a64 100644 --- a/tests/system/Validation/StrictRules/ValidationTest.php +++ b/tests/system/Validation/StrictRules/ValidationTest.php @@ -24,7 +24,7 @@ final class ValidationTest extends TraditionalValidationTest { /** - * @var array|string>|string>|string> + * @var array|string>|string>|string> */ protected static array $config = [ 'ruleSets' => [ diff --git a/tests/system/Validation/ValidationTest.php b/tests/system/Validation/ValidationTest.php index 7cf70deaeb27..3a0f57a0e8e6 100644 --- a/tests/system/Validation/ValidationTest.php +++ b/tests/system/Validation/ValidationTest.php @@ -40,7 +40,7 @@ class ValidationTest extends CIUnitTestCase protected Validation $validation; /** - * @var array|string>|string>|string> + * @var array|string>|string>|string> */ protected static array $config = [ 'ruleSets' => [ diff --git a/utils/phpstan-baseline/argument.type.neon b/utils/phpstan-baseline/argument.type.neon index bbd0685fcf76..7fbc636537e7 100644 --- a/utils/phpstan-baseline/argument.type.neon +++ b/utils/phpstan-baseline/argument.type.neon @@ -1,12 +1,7 @@ -# total 73 errors +# total 68 errors parameters: ignoreErrors: - - - message: '#^Parameter \#2 \$params of method CodeIgniter\\CLI\\BaseCommand\:\:call\(\) expects array\, array\ given\.$#' - count: 2 - path: ../../system/Commands/Database/MigrateRefresh.php - - message: '#^Parameter \#3 \.\.\.\$arrays of function array_map expects array, int\|string given\.$#' count: 1 @@ -102,21 +97,6 @@ parameters: count: 1 path: ../../tests/system/Debug/TimerTest.php - - - message: '#^Parameter \#1 \$value of method CodeIgniter\\HTTP\\Header\:\:setValue\(\) expects array\\|string\>\|string\|null, array\ given\.$#' - count: 1 - path: ../../tests/system/HTTP/HeaderTest.php - - - - message: '#^Parameter \#2 \$value of class CodeIgniter\\HTTP\\Header constructor expects array\\|string\>\|string\|null, int given\.$#' - count: 1 - path: ../../tests/system/HTTP/HeaderTest.php - - - - message: '#^Parameter \#2 \$value of class CodeIgniter\\HTTP\\Header constructor expects array\\|string\>\|string\|null, stdClass given\.$#' - count: 1 - path: ../../tests/system/HTTP/HeaderTest.php - - message: '#^Parameter \#1 \$array of method CodeIgniter\\Superglobals\:\:setServerArray\(\) expects array\\|float\|int\|string\>, array\ given\.$#' count: 1 diff --git a/utils/phpstan-baseline/loader.neon b/utils/phpstan-baseline/loader.neon index 2e67047327fc..5214bfa1141b 100644 --- a/utils/phpstan-baseline/loader.neon +++ b/utils/phpstan-baseline/loader.neon @@ -1,4 +1,4 @@ -# total 1825 errors +# total 1819 errors includes: - argument.type.neon diff --git a/utils/phpstan-baseline/method.childParameterType.neon b/utils/phpstan-baseline/method.childParameterType.neon index 21752412ee34..f4316313dd85 100644 --- a/utils/phpstan-baseline/method.childParameterType.neon +++ b/utils/phpstan-baseline/method.childParameterType.neon @@ -1,12 +1,7 @@ -# total 11 errors +# total 10 errors parameters: ignoreErrors: - - - message: '#^Parameter \#1 \$params \(array\\) of method CodeIgniter\\Commands\\Database\\MigrateStatus\:\:run\(\) should be contravariant with parameter \$params \(array\\) of method CodeIgniter\\CLI\\BaseCommand\:\:run\(\)$#' - count: 1 - path: ../../system/Commands/Database/MigrateStatus.php - - message: '#^Parameter \#1 \$offset \(string\) of method CodeIgniter\\Cookie\\Cookie\:\:offsetSet\(\) should be contravariant with parameter \$offset \(string\|null\) of method ArrayAccess\\:\:offsetSet\(\)$#' count: 1