diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php index ab5069bcad13..3653cf1349c2 100644 --- a/.php-cs-fixer.dist.php +++ b/.php-cs-fixer.dist.php @@ -43,38 +43,7 @@ __DIR__ . '/spark', ]); -$overrides = [ - 'phpdoc_array_type' => true, - 'phpdoc_no_alias_tag' => [ - 'replacements' => [ - 'type' => 'var', - 'link' => 'see', - ], - ], - 'phpdoc_align' => [ - 'align' => 'vertical', - 'spacing' => 1, - 'tags' => [ - 'method', - 'param', - 'phpstan-assert', - 'phpstan-assert-if-true', - 'phpstan-assert-if-false', - 'phpstan-param', - 'phpstan-property', - 'phpstan-return', - 'phpstan-type', - 'phpstan-var', - 'property', - 'property-read', - 'property-write', - 'return', - 'throws', - 'type', - 'var', - ], - ], -]; +$overrides = []; $options = [ 'cacheFile' => 'build/.php-cs-fixer.cache', diff --git a/.php-cs-fixer.no-header.php b/.php-cs-fixer.no-header.php index 2f5b471f5b74..7c9ae1e80737 100644 --- a/.php-cs-fixer.no-header.php +++ b/.php-cs-fixer.no-header.php @@ -29,32 +29,7 @@ __DIR__ . '/admin/starter/builds', ]); -$overrides = [ - 'phpdoc_array_type' => true, - 'phpdoc_align' => [ - 'align' => 'vertical', - 'spacing' => 1, - 'tags' => [ - 'method', - 'param', - 'phpstan-assert', - 'phpstan-assert-if-true', - 'phpstan-assert-if-false', - 'phpstan-param', - 'phpstan-property', - 'phpstan-return', - 'phpstan-type', - 'phpstan-var', - 'property', - 'property-read', - 'property-write', - 'return', - 'throws', - 'type', - 'var', - ], - ], -]; +$overrides = []; $options = [ 'cacheFile' => 'build/.php-cs-fixer.no-header.cache', diff --git a/.php-cs-fixer.user-guide.php b/.php-cs-fixer.user-guide.php index b46bd6112b8b..fe634f0a6f21 100644 --- a/.php-cs-fixer.user-guide.php +++ b/.php-cs-fixer.user-guide.php @@ -39,30 +39,6 @@ 'import_symbols' => false, 'leading_backslash_in_global_namespace' => true, ], - 'phpdoc_array_type' => true, - 'phpdoc_align' => [ - 'align' => 'vertical', - 'spacing' => 1, - 'tags' => [ - 'method', - 'param', - 'phpstan-assert', - 'phpstan-assert-if-true', - 'phpstan-assert-if-false', - 'phpstan-param', - 'phpstan-property', - 'phpstan-return', - 'phpstan-type', - 'phpstan-var', - 'property', - 'property-read', - 'property-write', - 'return', - 'throws', - 'type', - 'var', - ], - ], ]; $options = [ diff --git a/app/Config/Cache.php b/app/Config/Cache.php index 8cae5b7732c1..b29c13a9ea71 100644 --- a/app/Config/Cache.php +++ b/app/Config/Cache.php @@ -61,7 +61,7 @@ class Cache extends BaseConfig * ['q'] = Enabled, but only take into account the specified list * of query parameters. * - * @var array|bool + * @var bool|list */ public $cacheQueryString = false; diff --git a/app/Config/ContentSecurityPolicy.php b/app/Config/ContentSecurityPolicy.php index 580c5c8b9f7e..f1c26ca9e011 100644 --- a/app/Config/ContentSecurityPolicy.php +++ b/app/Config/ContentSecurityPolicy.php @@ -45,28 +45,28 @@ class ContentSecurityPolicy extends BaseConfig /** * Will default to self if not overridden * - * @var array|string|null + * @var list|string|null */ public $defaultSrc; /** * Lists allowed scripts' URLs. * - * @var array|string + * @var list|string */ public $scriptSrc = 'self'; /** * Lists allowed stylesheets' URLs. * - * @var array|string + * @var list|string */ public $styleSrc = 'self'; /** * Defines the origins from which images can be loaded. * - * @var array|string + * @var list|string */ public $imageSrc = 'self'; @@ -75,14 +75,14 @@ class ContentSecurityPolicy extends BaseConfig * * Will default to self if not overridden * - * @var array|string|null + * @var list|string|null */ public $baseURI; /** * Lists the URLs for workers and embedded frame contents * - * @var array|string + * @var list|string */ public $childSrc = 'self'; @@ -90,21 +90,21 @@ class ContentSecurityPolicy extends BaseConfig * Limits the origins that you can connect to (via XHR, * WebSockets, and EventSource). * - * @var array|string + * @var list|string */ public $connectSrc = 'self'; /** * Specifies the origins that can serve web fonts. * - * @var array|string + * @var list|string */ public $fontSrc; /** * Lists valid endpoints for submission from `
` tags. * - * @var array|string + * @var list|string */ public $formAction = 'self'; @@ -114,7 +114,7 @@ class ContentSecurityPolicy extends BaseConfig * and `` tags. This directive can't be used in * `` tags and applies only to non-HTML resources. * - * @var array|string|null + * @var list|string|null */ public $frameAncestors; @@ -129,33 +129,33 @@ class ContentSecurityPolicy extends BaseConfig /** * Restricts the origins allowed to deliver video and audio. * - * @var array|string|null + * @var list|string|null */ public $mediaSrc; /** * Allows control over Flash and other plugins. * - * @var array|string + * @var list|string */ public $objectSrc = 'self'; /** - * @var array|string|null + * @var list|string|null */ public $manifestSrc; /** * Limits the kinds of plugins a page may invoke. * - * @var array|string|null + * @var list|string|null */ public $pluginTypes; /** * List of actions allowed. * - * @var array|string|null + * @var list|string|null */ public $sandbox; diff --git a/app/Config/Format.php b/app/Config/Format.php index 9cf244a9fd8c..3de98d7a95d7 100644 --- a/app/Config/Format.php +++ b/app/Config/Format.php @@ -22,7 +22,7 @@ class Format extends BaseConfig * These formats are only checked when the data passed to the respond() * method is an array. * - * @var array + * @var list */ public array $supportedResponseFormats = [ 'application/json', diff --git a/app/Config/Toolbar.php b/app/Config/Toolbar.php index 7758e3e85a8b..08012c2de9ae 100644 --- a/app/Config/Toolbar.php +++ b/app/Config/Toolbar.php @@ -31,7 +31,7 @@ class Toolbar extends BaseConfig * List of toolbar collectors that will be called when Debug Toolbar * fires up and collects data from. * - * @var array + * @var list */ public array $collectors = [ Timers::class, diff --git a/app/Config/Validation.php b/app/Config/Validation.php index 7fb2e8e2e4d9..6342dbbe7d38 100644 --- a/app/Config/Validation.php +++ b/app/Config/Validation.php @@ -18,7 +18,7 @@ class Validation extends BaseConfig * Stores the classes that contain the * rules that are available. * - * @var array + * @var list */ public array $ruleSets = [ Rules::class, diff --git a/app/Config/View.php b/app/Config/View.php index 5a0e2ce6c040..cf8dd06f1065 100644 --- a/app/Config/View.php +++ b/app/Config/View.php @@ -6,8 +6,8 @@ use CodeIgniter\View\ViewDecoratorInterface; /** - * @phpstan-type ParserCallable (callable(mixed): mixed) - * @phpstan-type ParserCallableString (callable(mixed): mixed)&string + * @phpstan-type parser_callable (callable(mixed): mixed) + * @phpstan-type parser_callable_string (callable(mixed): mixed)&string */ class View extends BaseView { @@ -35,7 +35,7 @@ class View extends BaseView * { created_on|date(Y-m-d)|esc(attr) } * * @var array - * @phpstan-var array + * @phpstan-var array */ public $filters = []; @@ -44,8 +44,8 @@ class View extends BaseView * by the core Parser by creating aliases that will be replaced with * any callable. Can be single or tag pair. * - * @var array|callable|string> - * @phpstan-var array|ParserCallableString|ParserCallable> + * @var array|string> + * @phpstan-var array|parser_callable_string|parser_callable> */ public $plugins = []; @@ -56,7 +56,7 @@ class View extends BaseView * * All classes must implement CodeIgniter\View\ViewDecoratorInterface * - * @var array> + * @var list> */ public array $decorators = []; } diff --git a/phpstan-baseline.php b/phpstan-baseline.php index 3b79f9639943..843603f976b5 100644 --- a/phpstan-baseline.php +++ b/phpstan-baseline.php @@ -1001,16 +1001,6 @@ 'count' => 2, 'path' => __DIR__ . '/system/Database/BaseResult.php', ]; -$ignoreErrors[] = [ - 'message' => '#^Only booleans are allowed in an if condition, array\\ given\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Database/BaseResult.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Only booleans are allowed in an if condition, array\\ given\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Database/BaseResult.php', -]; $ignoreErrors[] = [ 'message' => '#^Parameter \\#1 \\$className \\(class\\-string\\) of method CodeIgniter\\\\Database\\\\BaseResult\\:\\:getCustomResultObject\\(\\) should be contravariant with parameter \\$className \\(string\\) of method CodeIgniter\\\\Database\\\\ResultInterface\\\\:\\:getCustomResultObject\\(\\)$#', 'count' => 1, @@ -1091,6 +1081,11 @@ 'count' => 1, 'path' => __DIR__ . '/system/Database/Forge.php', ]; +$ignoreErrors[] = [ + 'message' => '#^Property CodeIgniter\\\\Database\\\\Forge\\:\\:\\$fields \\(array\\\\) does not accept array\\\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Database/Forge.php', +]; $ignoreErrors[] = [ 'message' => '#^Method CodeIgniter\\\\Database\\\\Migration\\:\\:down\\(\\) has no return type specified\\.$#', 'count' => 1, @@ -1256,16 +1251,6 @@ 'count' => 5, 'path' => __DIR__ . '/system/Database/OCI8/Connection.php', ]; -$ignoreErrors[] = [ - 'message' => '#^Only booleans are allowed in a negated boolean, array given\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Database/OCI8/Connection.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Only booleans are allowed in a negated boolean, array\\ given\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Database/OCI8/Connection.php', -]; $ignoreErrors[] = [ 'message' => '#^PHPDoc type string of property CodeIgniter\\\\Database\\\\OCI8\\\\Connection\\:\\:\\$escapeChar is not the same as PHPDoc type array\\|string of overridden property CodeIgniter\\\\Database\\\\BaseConnection\\\\:\\:\\$escapeChar\\.$#', 'count' => 1, @@ -3121,6 +3106,11 @@ 'count' => 1, 'path' => __DIR__ . '/system/Test/Mock/MockCURLRequest.php', ]; +$ignoreErrors[] = [ + 'message' => '#^Cannot unset offset string on array\\\\|null\\.$#', + 'count' => 2, + 'path' => __DIR__ . '/system/Test/Mock/MockCache.php', +]; $ignoreErrors[] = [ 'message' => '#^Method CodeIgniter\\\\Test\\\\Mock\\\\MockCache\\:\\:assertHas\\(\\) has no return type specified\\.$#', 'count' => 1, diff --git a/psalm-baseline.xml b/psalm-baseline.xml index c4240e2b7fc8..129aefd272a2 100644 --- a/psalm-baseline.xml +++ b/psalm-baseline.xml @@ -1,10 +1,10 @@ - + - ]]> - |ParserCallableString|ParserCallable>]]> - |ParserCallableString|ParserCallable>]]> + |parser_callable_string|parser_callable>]]> + |parser_callable_string|parser_callable>]]> + ]]> public $filters = []; public $plugins = []; public $plugins = []; @@ -34,8 +34,8 @@ - |parser_callable_string|parser_callable>]]> - |parser_callable_string|parser_callable>]]> + |parser_callable_string|parser_callable>]]> + |parser_callable_string|parser_callable>]]> ]]> '\abs', @@ -139,8 +139,8 @@ - |parser_callable_string|parser_callable>]]> - |parser_callable_string|parser_callable>]]> + |parser_callable_string|parser_callable>]]> + |parser_callable_string|parser_callable>]]> protected $plugins = []; protected $plugins = []; @@ -181,12 +181,6 @@ - - - username]]> - username]]> - - OCI_ASSOC diff --git a/system/API/ResponseTrait.php b/system/API/ResponseTrait.php index d8b917b2054d..83a14528f6c3 100644 --- a/system/API/ResponseTrait.php +++ b/system/API/ResponseTrait.php @@ -234,7 +234,7 @@ protected function failValidationError(string $description = 'Bad Request', ?str /** * Used when the data provided by the client cannot be validated on one or more fields. * - * @param array|string $errors + * @param list|string $errors * * @return ResponseInterface */ diff --git a/system/Autoloader/Autoloader.php b/system/Autoloader/Autoloader.php index 9a6073d96336..2f9b13c0b818 100644 --- a/system/Autoloader/Autoloader.php +++ b/system/Autoloader/Autoloader.php @@ -61,7 +61,7 @@ class Autoloader /** * Stores namespaces as key, and path as values. * - * @var array> + * @var array> */ protected $prefixes = []; diff --git a/system/Autoloader/FileLocator.php b/system/Autoloader/FileLocator.php index 77c34f9e9e3f..6f1c547d2358 100644 --- a/system/Autoloader/FileLocator.php +++ b/system/Autoloader/FileLocator.php @@ -301,7 +301,7 @@ public function findQualifiedNameFromPath(string $path) * Scans the defined namespaces, returning a list of all files * that are contained within the subpath specified by $path. * - * @return array List of file paths + * @return list List of file paths */ public function listFiles(string $path): array { @@ -334,7 +334,7 @@ public function listFiles(string $path): array * Scans the provided namespace, returning a list of all files * that are contained within the sub path specified by $path. * - * @return array List of file paths + * @return list List of file paths */ public function listNamespaceFiles(string $prefix, string $path): array { diff --git a/system/BaseModel.php b/system/BaseModel.php index 7540f84df4a5..8cc4cca3ba43 100644 --- a/system/BaseModel.php +++ b/system/BaseModel.php @@ -439,7 +439,7 @@ abstract protected function doUpdate($id = null, $row = null): bool; * @param int $batchSize The size of the batch to run * @param bool $returnSQL True means SQL is returned, false will execute the query * - * @return array|false|int Number of rows affected or FALSE on failure, SQL array when testMode + * @return false|int|list Number of rows affected or FALSE on failure, SQL array when testMode * * @throws DatabaseException */ @@ -1005,7 +1005,7 @@ public function update($id = null, $row = null): bool * @param int $batchSize The size of the batch to run * @param bool $returnSQL True means SQL is returned, false will execute the query * - * @return array|false|int Number of rows affected or FALSE on failure, SQL array when testMode + * @return false|int|list Number of rows affected or FALSE on failure, SQL array when testMode * * @throws DatabaseException * @throws ReflectionException diff --git a/system/Cache/ResponseCache.php b/system/Cache/ResponseCache.php index e59e285b6970..c82251856755 100644 --- a/system/Cache/ResponseCache.php +++ b/system/Cache/ResponseCache.php @@ -35,7 +35,7 @@ final class ResponseCache * array('q') = Enabled, but only take into account the specified list * of query parameters. * - * @var array|bool + * @var bool|list */ private $cacheQueryString = false; diff --git a/system/CodeIgniter.php b/system/CodeIgniter.php index 11541524d57b..be917d2f494c 100644 --- a/system/CodeIgniter.php +++ b/system/CodeIgniter.php @@ -800,7 +800,7 @@ public function displayPerformanceMetrics(string $output): string * @param RouteCollectionInterface|null $routes A collection interface to use in place * of the config file. * - * @return array|string|null Route filters, that is, the filters specified in the routes file + * @return list|string|null Route filters, that is, the filters specified in the routes file * * @throws RedirectException */ diff --git a/system/Commands/Database/MigrateStatus.php b/system/Commands/Database/MigrateStatus.php index 8f8ce4d7b67a..cbbe2f70ce47 100644 --- a/system/Commands/Database/MigrateStatus.php +++ b/system/Commands/Database/MigrateStatus.php @@ -63,7 +63,7 @@ class MigrateStatus extends BaseCommand /** * Namespaces to ignore when looking for migrations. * - * @var array + * @var list */ protected $ignoredNamespaces = [ 'CodeIgniter', diff --git a/system/Commands/Utilities/Routes/AutoRouterImproved/AutoRouteCollector.php b/system/Commands/Utilities/Routes/AutoRouterImproved/AutoRouteCollector.php index be9ec94ec275..5a62f8eea8c6 100644 --- a/system/Commands/Utilities/Routes/AutoRouterImproved/AutoRouteCollector.php +++ b/system/Commands/Utilities/Routes/AutoRouterImproved/AutoRouteCollector.php @@ -33,7 +33,7 @@ final class AutoRouteCollector /** * List of controllers in Defined Routes that should not be accessed via Auto-Routing. * - * @var array + * @var list */ private array $protectedControllers; diff --git a/system/Commands/Utilities/Routes/ControllerFinder.php b/system/Commands/Utilities/Routes/ControllerFinder.php index a8912aa07b13..f11076cf5fff 100644 --- a/system/Commands/Utilities/Routes/ControllerFinder.php +++ b/system/Commands/Utilities/Routes/ControllerFinder.php @@ -38,7 +38,7 @@ public function __construct(string $namespace) } /** - * @return array + * @return list */ public function find(): array { diff --git a/system/Common.php b/system/Common.php index 2b09522e0b56..093943effb47 100644 --- a/system/Common.php +++ b/system/Common.php @@ -236,8 +236,8 @@ function cookie(string $name, string $value = '', array $options = []): Cookie /** * Fetches the global `CookieStore` instance held by `Response`. * - * @param array $cookies If `getGlobal` is false, this is passed to CookieStore's constructor - * @param bool $getGlobal If false, creates a new instance of CookieStore + * @param list $cookies If `getGlobal` is false, this is passed to CookieStore's constructor + * @param bool $getGlobal If false, creates a new instance of CookieStore */ function cookies(array $cookies = [], bool $getGlobal = true): CookieStore { diff --git a/system/Config/BaseService.php b/system/Config/BaseService.php index 1c80c80d77c6..835145eee460 100644 --- a/system/Config/BaseService.php +++ b/system/Config/BaseService.php @@ -170,7 +170,7 @@ class BaseService /** * A cache of the names of services classes found. * - * @var array + * @var list */ private static array $serviceNames = []; diff --git a/system/Config/View.php b/system/Config/View.php index f527854813d6..403d933be5b8 100644 --- a/system/Config/View.php +++ b/system/Config/View.php @@ -51,8 +51,8 @@ class View extends BaseConfig * * @psalm-suppress UndefinedDocblockClass * - * @var array|callable|string> - * @phpstan-var array|parser_callable_string|parser_callable> + * @var array|string> + * @phpstan-var array|parser_callable_string|parser_callable> */ public $plugins = []; @@ -89,7 +89,7 @@ class View extends BaseConfig /** * Built-in View plugins. * - * @var array|callable|string> + * @var array|string> * @phpstan-var array|parser_callable_string|parser_callable> */ protected $corePlugins = [ @@ -112,7 +112,7 @@ class View extends BaseConfig * * All classes must implement CodeIgniter\View\ViewDecoratorInterface * - * @var array> + * @var list> */ public array $decorators = []; diff --git a/system/Cookie/CookieStore.php b/system/Cookie/CookieStore.php index 99c1dd9fff66..715c1939685f 100644 --- a/system/Cookie/CookieStore.php +++ b/system/Cookie/CookieStore.php @@ -35,7 +35,7 @@ class CookieStore implements Countable, IteratorAggregate /** * Creates a CookieStore from an array of `Set-Cookie` headers. * - * @param array $headers + * @param list $headers * * @return static * @@ -44,7 +44,7 @@ class CookieStore implements Countable, IteratorAggregate public static function fromCookieHeaders(array $headers, bool $raw = false) { /** - * @var array $cookies + * @var list $cookies */ $cookies = array_filter(array_map(static function (string $header) use ($raw) { try { @@ -60,7 +60,7 @@ public static function fromCookieHeaders(array $headers, bool $raw = false) } /** - * @param array $cookies + * @param array $cookies * * @throws CookieException */ diff --git a/system/Cookie/Exceptions/CookieException.php b/system/Cookie/Exceptions/CookieException.php index 0b18d9eb8356..af466061155b 100644 --- a/system/Cookie/Exceptions/CookieException.php +++ b/system/Cookie/Exceptions/CookieException.php @@ -104,7 +104,7 @@ public static function forInvalidSameSiteNone() /** * Thrown when the `CookieStore` class is filled with invalid Cookie objects. * - * @param array $data + * @param list $data * * @return static */ @@ -116,7 +116,7 @@ public static function forInvalidCookieInstance(array $data) /** * Thrown when the queried Cookie object does not exist in the cookie collection. * - * @param array $data + * @param list $data * * @return static */ diff --git a/system/Database/BaseBuilder.php b/system/Database/BaseBuilder.php index d6fc3aa6262c..4163355b7ce3 100644 --- a/system/Database/BaseBuilder.php +++ b/system/Database/BaseBuilder.php @@ -116,7 +116,7 @@ class BaseBuilder /** * QB UNION data * - * @var array + * @var list */ protected array $QBUnion = []; @@ -281,14 +281,14 @@ class BaseBuilder /** * Strings that determine if a string represents a literal value or a field name * - * @var array + * @var list */ protected $isLiteralStr = []; /** * RegExp used to get operators * - * @var array + * @var list */ protected $pregOperators = []; @@ -1763,7 +1763,7 @@ public function getWhere($where = null, ?int $limit = null, ?int $offset = 0, bo * * @param '_deleteBatch'|'_insertBatch'|'_updateBatch'|'_upsertBatch' $renderMethod * - * @return array|false|int Number of rows inserted or FALSE on failure, SQL array when testMode + * @return false|int|list Number of rows inserted or FALSE on failure, SQL array when testMode * * @throws DatabaseException */ @@ -1900,7 +1900,7 @@ public function getCompiledUpsert() * * @param array|object|null $set * - * @return array|false|int Number of affected rows or FALSE on failure, SQL array when testMode + * @return false|int|list Number of affected rows or FALSE on failure, SQL array when testMode * * @throws DatabaseException */ @@ -1936,7 +1936,7 @@ public function upsert($set = null, ?bool $escape = null) * * @param array|object|null $set a dataset * - * @return array|false|int Number of affected rows or FALSE on failure, SQL array when testMode + * @return false|int|list Number of affected rows or FALSE on failure, SQL array when testMode * * @throws DatabaseException */ @@ -2021,9 +2021,9 @@ private function setAlias(string $alias): BaseBuilder /** * Sets update fields for upsert, update * - * @param array|array|string $set - * @param bool $addToDefault adds update fields to the default ones - * @param array|null $ignore ignores items in set + * @param list|list|string $set + * @param bool $addToDefault adds update fields to the default ones + * @param array|null $ignore ignores items in set * * @return $this */ @@ -2165,7 +2165,7 @@ protected function formatValues(array $values): array * * @param array|object|null $set a dataset * - * @return array|false|int Number of rows inserted or FALSE on failure, SQL array when testMode + * @return false|int|list Number of rows inserted or FALSE on failure, SQL array when testMode */ public function insertBatch($set = null, ?bool $escape = null, int $batchSize = 100) { @@ -2531,7 +2531,7 @@ protected function validateUpdate(): bool * @param array|object|null $set a dataset * @param array|RawSql|string|null $constraints * - * @return array|false|int Number of rows affected or FALSE on failure, SQL array when testMode + * @return false|int|list Number of rows affected or FALSE on failure, SQL array when testMode */ public function updateBatch($set = null, $constraints = null, int $batchSize = 100) { @@ -2793,7 +2793,7 @@ public function delete($where = '', ?int $limit = null, bool $resetData = true) * @param array|object|null $set a dataset * @param array|RawSql|null $constraints * - * @return array|false|int Number of rows affected or FALSE on failure, SQL array when testMode + * @return false|int|list Number of rows affected or FALSE on failure, SQL array when testMode */ public function deleteBatch($set = null, $constraints = null, int $batchSize = 100) { diff --git a/system/Database/BaseConnection.php b/system/Database/BaseConnection.php index 3ca7c4988ca7..9b131152210b 100644 --- a/system/Database/BaseConnection.php +++ b/system/Database/BaseConnection.php @@ -1279,10 +1279,10 @@ public function escape($str) /** * Escape String * - * @param array|string $str Input string - * @param bool $like Whether or not the string will be used in a LIKE condition + * @param list|string $str Input string + * @param bool $like Whether or not the string will be used in a LIKE condition * - * @return array|string + * @return list|string */ public function escapeString($str, bool $like = false) { @@ -1322,9 +1322,9 @@ public function escapeString($str, bool $like = false) * Calls the individual driver for platform * specific escaping for LIKE conditions * - * @param array|string $str + * @param list|string $str * - * @return array|string + * @return list|string */ public function escapeLikeString($str) { @@ -1517,7 +1517,7 @@ public function fieldExists(string $fieldName, string $tableName): bool /** * Returns an object with field data * - * @return array + * @return list */ public function getFieldData(string $table) { diff --git a/system/Database/BaseResult.php b/system/Database/BaseResult.php index b4d8c6a43fe5..8a624029b3a2 100644 --- a/system/Database/BaseResult.php +++ b/system/Database/BaseResult.php @@ -41,14 +41,14 @@ abstract class BaseResult implements ResultInterface /** * Result Array * - * @var array + * @var list */ public $resultArray = []; /** * Result Object * - * @var array + * @var list */ public $resultObject = []; @@ -185,7 +185,7 @@ public function getResultArray(): array return []; } - if ($this->resultObject) { + if ($this->resultObject !== []) { foreach ($this->resultObject as $row) { $this->resultArray[] = (array) $row; } @@ -225,7 +225,7 @@ public function getResultObject(): array return []; } - if ($this->resultArray) { + if ($this->resultArray !== []) { foreach ($this->resultArray as $row) { $this->resultObject[] = (object) $row; } diff --git a/system/Database/Forge.php b/system/Database/Forge.php index c2659a88ce0e..6226255be210 100644 --- a/system/Database/Forge.php +++ b/system/Database/Forge.php @@ -39,7 +39,7 @@ class Forge /** * List of keys. * - * @var list, keyName?: string}> + * @var list, keyName?: string}> */ protected $keys = []; @@ -53,7 +53,7 @@ class Forge /** * Primary keys. * - * @var array{fields?: array, keyName?: string} + * @var array{fields?: list, keyName?: string} */ protected $primaryKeys = []; @@ -399,8 +399,8 @@ public function addField($fields) /** * Add Foreign Key * - * @param array|string $fieldName - * @param array|string $tableField + * @param list|string $fieldName + * @param list|string $tableField * * @throws DatabaseException */ diff --git a/system/Database/MySQLi/Connection.php b/system/Database/MySQLi/Connection.php index 74d296c70036..03aab408398a 100644 --- a/system/Database/MySQLi/Connection.php +++ b/system/Database/MySQLi/Connection.php @@ -355,9 +355,9 @@ protected function _escapeString(string $str): string * additional "ESCAPE x" parameter for specifying the escape character * in "LIKE" strings, and this handles those directly with a backslash. * - * @param array|string $str Input string + * @param list|string $str Input string * - * @return array|string + * @return list|string */ public function escapeLikeStringDirect($str) { @@ -411,7 +411,7 @@ protected function _listColumns(string $table = ''): string /** * Returns an array of objects with field data * - * @return array + * @return list * * @throws DatabaseException */ @@ -443,7 +443,7 @@ protected function _fieldData(string $table): array /** * Returns an array of objects with index data * - * @return array + * @return list * * @throws DatabaseException * @throws LogicException @@ -489,7 +489,7 @@ protected function _indexData(string $table): array /** * Returns an array of objects with Foreign key data * - * @return array + * @return list * * @throws DatabaseException */ diff --git a/system/Database/OCI8/Connection.php b/system/Database/OCI8/Connection.php index beb3ba00c039..fc7920e2a8ff 100644 --- a/system/Database/OCI8/Connection.php +++ b/system/Database/OCI8/Connection.php @@ -281,7 +281,7 @@ protected function _listColumns(string $table = ''): string /** * Returns an array of objects with field data * - * @return array + * @return list * * @throws DatabaseException */ @@ -325,7 +325,7 @@ protected function _fieldData(string $table): array /** * Returns an array of objects with index data * - * @return array + * @return list * * @throws DatabaseException */ @@ -374,7 +374,7 @@ protected function _indexData(string $table): array /** * Returns an array of objects with Foreign key data * - * @return array + * @return list * * @throws DatabaseException */ @@ -578,7 +578,7 @@ public function insertID(): int $indexs = $this->getIndexData($this->lastInsertedTableName); $fieldDatas = $this->getFieldData($this->lastInsertedTableName); - if (! $indexs || ! $fieldDatas) { + if ($indexs === [] || $fieldDatas === []) { return 0; } diff --git a/system/Database/Postgre/Connection.php b/system/Database/Postgre/Connection.php index d05d564812a2..0f761db197b9 100644 --- a/system/Database/Postgre/Connection.php +++ b/system/Database/Postgre/Connection.php @@ -294,7 +294,7 @@ protected function _listColumns(string $table = ''): string /** * Returns an array of objects with field data * - * @return array + * @return list * * @throws DatabaseException */ @@ -329,7 +329,7 @@ protected function _fieldData(string $table): array /** * Returns an array of objects with index data * - * @return array + * @return list * * @throws DatabaseException */ @@ -368,7 +368,7 @@ protected function _indexData(string $table): array /** * Returns an array of objects with Foreign key data * - * @return array + * @return list * * @throws DatabaseException */ diff --git a/system/Database/SQLSRV/Connection.php b/system/Database/SQLSRV/Connection.php index f6ba6fffaba6..bc3e036078c9 100755 --- a/system/Database/SQLSRV/Connection.php +++ b/system/Database/SQLSRV/Connection.php @@ -77,7 +77,7 @@ class Connection extends BaseConnection * * Identifiers that must NOT be escaped. * - * @var array + * @var list */ protected $_reserved_identifiers = ['*']; @@ -231,7 +231,7 @@ protected function _listColumns(string $table = ''): string /** * Returns an array of objects with index data * - * @return array + * @return list * * @throws DatabaseException */ @@ -269,7 +269,7 @@ protected function _indexData(string $table): array * Returns an array of objects with Foreign key data * referenced_object_id parent_object_id * - * @return array + * @return list * * @throws DatabaseException */ @@ -335,7 +335,7 @@ protected function _enableForeignKeyChecks() /** * Returns an array of objects with field data * - * @return array + * @return list * * @throws DatabaseException */ diff --git a/system/Database/SQLite3/Connection.php b/system/Database/SQLite3/Connection.php index 1e38ee5d3ae7..be4ebc25f0ca 100644 --- a/system/Database/SQLite3/Connection.php +++ b/system/Database/SQLite3/Connection.php @@ -248,7 +248,7 @@ public function getFieldNames(string $table) /** * Returns an array of objects with field data * - * @return array + * @return list * * @throws DatabaseException */ @@ -286,7 +286,7 @@ protected function _fieldData(string $table): array /** * Returns an array of objects with index data * - * @return array + * @return list * * @throws DatabaseException */ @@ -343,7 +343,7 @@ protected function _indexData(string $table): array /** * Returns an array of objects with Foreign key data * - * @return array + * @return list */ protected function _foreignKeyData(string $table): array { diff --git a/system/Debug/Toolbar.php b/system/Debug/Toolbar.php index 7e8a73fadb68..8f9ab2a6d461 100644 --- a/system/Debug/Toolbar.php +++ b/system/Debug/Toolbar.php @@ -43,7 +43,7 @@ class Toolbar /** * Collectors to be used and displayed. * - * @var array + * @var list */ protected $collectors = []; diff --git a/system/Email/Email.php b/system/Email/Email.php index bac2b5682d05..8e8c0b77762d 100644 --- a/system/Email/Email.php +++ b/system/Email/Email.php @@ -296,7 +296,7 @@ class Email /** * Raw debug messages * - * @var array + * @var list */ private array $debugMessageRaw = []; diff --git a/system/Events/Events.php b/system/Events/Events.php index c8f65e9cb360..f756fa0ec0c4 100644 --- a/system/Events/Events.php +++ b/system/Events/Events.php @@ -52,14 +52,14 @@ class Events * Stores information about the events * for display in the debug toolbar. * - * @var array> + * @var list> */ protected static $performanceLog = []; /** * A list of found files. * - * @var array + * @var list */ protected static $files = []; @@ -253,7 +253,7 @@ public static function setFiles(array $files) /** * Returns the files that were found/loaded during this request. * - * @return array + * @return list */ public static function getFiles() { @@ -275,7 +275,7 @@ public static function simulate(bool $choice = true) /** * Getter for the performance log records. * - * @return array> + * @return list> */ public static function getPerformanceLogs() { diff --git a/system/Files/FileCollection.php b/system/Files/FileCollection.php index ad24d708ea00..8e608e3ab311 100644 --- a/system/Files/FileCollection.php +++ b/system/Files/FileCollection.php @@ -32,7 +32,7 @@ class FileCollection implements Countable, IteratorAggregate /** * The current list of file paths. * - * @var array + * @var list */ protected $files = []; @@ -75,9 +75,9 @@ final protected static function resolveFile(string $file): string /** * Removes files that are not part of the given directory (recursive). * - * @param array $files + * @param list $files * - * @return array + * @return list */ final protected static function filterFiles(array $files, string $directory): array { @@ -89,10 +89,10 @@ final protected static function filterFiles(array $files, string $directory): ar /** * Returns any files whose `basename` matches the given pattern. * - * @param array $files - * @param string $pattern Regex or pseudo-regex string + * @param list $files + * @param string $pattern Regex or pseudo-regex string * - * @return array + * @return list */ final protected static function matchFiles(array $files, string $pattern): array { @@ -116,7 +116,7 @@ final protected static function matchFiles(array $files, string $pattern): array /** * Loads the Filesystem helper and adds any initial files. * - * @param array $files + * @param list $files */ public function __construct(array $files = []) { @@ -136,7 +136,7 @@ protected function define(): void /** * Optimizes and returns the current file list. * - * @return array + * @return list */ public function get(): array { @@ -150,7 +150,7 @@ public function get(): array * Sets the file list directly, files are still subject to verification. * This works as a "reset" method with []. * - * @param array $files The new file list to use + * @param list $files The new file list to use * * @return $this */ @@ -164,7 +164,7 @@ public function set(array $files) /** * Adds an array/single file or directory to the list. * - * @param array|string $paths + * @param list|string $paths * * @return $this */ @@ -199,7 +199,7 @@ public function add($paths, bool $recursive = true) /** * Verifies and adds files to the list. * - * @param array $files + * @param list $files * * @return $this */ @@ -227,7 +227,7 @@ public function addFile(string $file) /** * Removes files from the list. * - * @param array $files + * @param list $files * * @return $this */ @@ -256,7 +256,7 @@ public function removeFile(string $file) * Verifies and adds files from each * directory to the list. * - * @param array $directories + * @param list $directories * * @return $this */ diff --git a/system/HTTP/Files/FileCollection.php b/system/HTTP/Files/FileCollection.php index 9edf1be9c16e..2ce05e2c3a4c 100644 --- a/system/HTTP/Files/FileCollection.php +++ b/system/HTTP/Files/FileCollection.php @@ -163,7 +163,7 @@ protected function populateFiles() * Given a file array, will create UploadedFile instances. Will * loop over an array and create objects for each. * - * @return array|UploadedFile + * @return list|UploadedFile */ protected function createFileObject(array $array) { diff --git a/system/HTTP/ResponseInterface.php b/system/HTTP/ResponseInterface.php index 0f76b000d5c2..4455bc648ee0 100644 --- a/system/HTTP/ResponseInterface.php +++ b/system/HTTP/ResponseInterface.php @@ -350,7 +350,7 @@ public function hasCookie(string $name, ?string $value = null, string $prefix = /** * Returns the cookie * - * @return array|Cookie|null + * @return array|Cookie|null */ public function getCookie(?string $name = null, string $prefix = ''); @@ -364,7 +364,7 @@ public function deleteCookie(string $name = '', string $domain = '', string $pat /** * Returns all cookies currently set. * - * @return array + * @return array */ public function getCookies(); diff --git a/system/HTTP/ResponseTrait.php b/system/HTTP/ResponseTrait.php index 8a6de1f9dd9c..c272887d4fec 100644 --- a/system/HTTP/ResponseTrait.php +++ b/system/HTTP/ResponseTrait.php @@ -644,7 +644,7 @@ public function hasCookie(string $name, ?string $value = null, string $prefix = * @param string $prefix Cookie prefix. * '': the default prefix * - * @return array|Cookie|null + * @return array|Cookie|null */ public function getCookie(?string $name = null, string $prefix = '') { @@ -709,7 +709,7 @@ public function deleteCookie(string $name = '', string $domain = '', string $pat /** * Returns all cookies currently set. * - * @return array + * @return array */ public function getCookies() { diff --git a/system/Helpers/form_helper.php b/system/Helpers/form_helper.php index a9c348c82f23..97ac2c2a8c5c 100644 --- a/system/Helpers/form_helper.php +++ b/system/Helpers/form_helper.php @@ -544,11 +544,11 @@ function form_close(string $extra = ''): string * Grabs a value from the POST array for the specified field so you can * re-populate an input field or textarea * - * @param string $field Field name - * @param array|string $default Default value - * @param bool $htmlEscape Whether to escape HTML special characters or not + * @param string $field Field name + * @param list|string $default Default value + * @param bool $htmlEscape Whether to escape HTML special characters or not * - * @return array|string + * @return list|string */ function set_value(string $field, $default = '', bool $htmlEscape = true) { diff --git a/system/Language/Language.php b/system/Language/Language.php index c43c7a0d5c12..6d4105861fd7 100644 --- a/system/Language/Language.php +++ b/system/Language/Language.php @@ -173,8 +173,8 @@ protected function parseLine(string $line, string $locale): array /** * Advanced message formatting. * - * @param array|string $message - * @param array $args + * @param array|string $message + * @param list $args * * @return array|string */ diff --git a/system/Log/Handlers/ErrorlogHandler.php b/system/Log/Handlers/ErrorlogHandler.php index f56b7a8e9a43..3ff5ebf669d1 100644 --- a/system/Log/Handlers/ErrorlogHandler.php +++ b/system/Log/Handlers/ErrorlogHandler.php @@ -43,7 +43,7 @@ class ErrorlogHandler extends BaseHandler /** * Constructor. * - * @param array $config + * @param list $config */ public function __construct(array $config = []) { diff --git a/system/Model.php b/system/Model.php index abc8e725ece9..69f84c9e19c7 100644 --- a/system/Model.php +++ b/system/Model.php @@ -137,7 +137,7 @@ class Model extends BaseModel /** * Builder method names that should not be used in the Model. * - * @var array method name + * @var list method name */ private array $builderMethodsNotAvailable = [ 'getCompiledInsert', @@ -402,7 +402,7 @@ protected function doUpdate($id = null, $row = null): bool * @param int $batchSize The size of the batch to run * @param bool $returnSQL True means SQL is returned, false will execute the query * - * @return array|false|int Number of rows affected or FALSE on failure, SQL array when testMode + * @return false|int|list Number of rows affected or FALSE on failure, SQL array when testMode * * @throws DatabaseException */ diff --git a/system/Publisher/Publisher.php b/system/Publisher/Publisher.php index 501329e36a6b..a143dac5828a 100644 --- a/system/Publisher/Publisher.php +++ b/system/Publisher/Publisher.php @@ -40,7 +40,7 @@ class Publisher extends FileCollection /** * Array of discovered Publishers. * - * @var array|null> + * @var array|null> */ private static array $discovered = []; @@ -60,7 +60,7 @@ class Publisher extends FileCollection /** * List of file published curing the last write operation. * - * @var array + * @var list */ private array $published = []; @@ -95,7 +95,7 @@ class Publisher extends FileCollection /** * Discovers and returns all Publishers in the specified namespace directory. * - * @return array + * @return list */ final public static function discover(string $directory = 'Publishers'): array { @@ -252,7 +252,7 @@ final public function getErrors(): array /** * Returns the files published by the last write operation. * - * @return array + * @return list */ final public function getPublished(): array { @@ -266,7 +266,7 @@ final public function getPublished(): array /** * Verifies and adds paths to the list. * - * @param array $paths + * @param list $paths * * @return $this */ @@ -294,7 +294,7 @@ final public function addPath(string $path, bool $recursive = true) /** * Downloads and stages files from an array of URIs. * - * @param array $uris + * @param list $uris * * @return $this */ diff --git a/system/Router/AutoRouterImproved.php b/system/Router/AutoRouterImproved.php index 8c418df1583d..a21814fca47e 100644 --- a/system/Router/AutoRouterImproved.php +++ b/system/Router/AutoRouterImproved.php @@ -27,7 +27,7 @@ final class AutoRouterImproved implements AutoRouterInterface /** * List of controllers in Defined Routes that should not be accessed via this Auto-Routing. * - * @var array + * @var list */ private array $protectedControllers; @@ -100,8 +100,8 @@ final class AutoRouterImproved implements AutoRouterInterface private ?int $paramPos = null; /** - * @param array $protectedControllers - * @param string $defaultController Short classname + * @param list $protectedControllers + * @param string $defaultController Short classname * * @deprecated $httpVerb is deprecated. No longer used. */ diff --git a/system/Router/RouteCollection.php b/system/Router/RouteCollection.php index 11fe54157160..2adb0ed98638 100644 --- a/system/Router/RouteCollection.php +++ b/system/Router/RouteCollection.php @@ -1596,7 +1596,7 @@ private function getMethodParams(string $from): string * Compares the subdomain(s) passed in against the current subdomain * on this page request. * - * @param array|string $subdomains + * @param list|string $subdomains */ private function checkSubdomains($subdomains): bool { diff --git a/system/Router/Router.php b/system/Router/Router.php index 34d172360c3d..8f03b4dcaad2 100644 --- a/system/Router/Router.php +++ b/system/Router/Router.php @@ -114,7 +114,7 @@ class Router implements RouterInterface * The filter info from Route Collection * if the matched route should be filtered. * - * @var array + * @var list */ protected $filtersInfo = []; @@ -228,7 +228,7 @@ public function getFilter() /** * Returns the filter info for the matched route, if any. * - * @return array + * @return list */ public function getFilters(): array { diff --git a/system/Test/FilterTestTrait.php b/system/Test/FilterTestTrait.php index 2ec0563595db..9b511e6a1d4b 100644 --- a/system/Test/FilterTestTrait.php +++ b/system/Test/FilterTestTrait.php @@ -208,7 +208,7 @@ protected function getFilterCaller($filter, string $position): Closure * @param string $route The route to test * @param string $position "before" or "after" * - * @return array The filter aliases + * @return list The filter aliases */ protected function getFiltersForRoute(string $route, string $position): array { diff --git a/system/Test/Mock/MockCache.php b/system/Test/Mock/MockCache.php index 30bbd18f8be6..8349b741bfc3 100644 --- a/system/Test/Mock/MockCache.php +++ b/system/Test/Mock/MockCache.php @@ -29,7 +29,7 @@ class MockCache extends BaseHandler implements CacheInterface /** * Expiration times. * - * @var ?array + * @var ?list */ protected $expirations = []; @@ -203,7 +203,7 @@ public function clean() * The information returned and the structure of the data * varies depending on the handler. * - * @return array Keys currently present in the store + * @return list Keys currently present in the store */ public function getCacheInfo() { diff --git a/system/Test/Mock/MockSession.php b/system/Test/Mock/MockSession.php index 63339788d084..5bab01ea31c2 100644 --- a/system/Test/Mock/MockSession.php +++ b/system/Test/Mock/MockSession.php @@ -26,7 +26,7 @@ class MockSession extends Session /** * Holds our "cookie" data. * - * @var array + * @var list */ public $cookies = []; diff --git a/system/Validation/Validation.php b/system/Validation/Validation.php index 4101c41ce898..af7cae093bb9 100644 --- a/system/Validation/Validation.php +++ b/system/Validation/Validation.php @@ -234,7 +234,7 @@ private static function getRegex(string $field): string * * @param array|bool|float|int|object|string|null $value The data to validate. * @param array|string $rules The validation rules. - * @param array $errors The custom error message. + * @param list $errors The custom error message. * @param string|null $dbGroup The database group to use. */ public function check($value, $rules, array $errors = [], $dbGroup = null): bool @@ -626,7 +626,7 @@ public function hasRule(string $field): bool * * @param string $group Group. * - * @return array Rule group. + * @return list Rule group. * * @throws ValidationException If group not found. */ diff --git a/system/Validation/ValidationInterface.php b/system/Validation/ValidationInterface.php index 9bde5c2a4873..323d47610a4f 100644 --- a/system/Validation/ValidationInterface.php +++ b/system/Validation/ValidationInterface.php @@ -34,7 +34,7 @@ public function run(?array $data = null, ?string $group = null, ?string $dbGroup * * @param array|bool|float|int|object|string|null $value Value to validate. * @param array|string $rules - * @param array $errors + * @param list $errors * @param string|null $dbGroup The database group to use. * * @return bool True if valid, else false. @@ -84,7 +84,7 @@ public function hasRule(string $field): bool; * * @param string $group Group. * - * @return array Rule group. + * @return list Rule group. */ public function getRuleGroup(string $group): array; diff --git a/system/View/Parser.php b/system/View/Parser.php index 4db85195addd..40ced2af8967 100644 --- a/system/View/Parser.php +++ b/system/View/Parser.php @@ -63,7 +63,7 @@ class Parser extends View /** * Stores any plugins registered at run-time. * - * @var array|callable|string> + * @var array|string> * @phpstan-var array|parser_callable_string|parser_callable> */ protected $plugins = []; diff --git a/system/View/View.php b/system/View/View.php index ad5c38de9b2f..4e855c6693c3 100644 --- a/system/View/View.php +++ b/system/View/View.php @@ -137,7 +137,7 @@ class View implements RendererInterface * The name of the current section being rendered, * if any. * - * @var array + * @var list */ protected $sectionStack = []; diff --git a/tests/system/Helpers/FilesystemHelperTest.php b/tests/system/Helpers/FilesystemHelperTest.php index 7f7c15dc323d..403802b15f34 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 + * @var array>>|array>|array>|array|array|mixed */ private array $structure; diff --git a/tests/system/Validation/ValidationTest.php b/tests/system/Validation/ValidationTest.php index 6d3214549082..c78e5689bdb1 100644 --- a/tests/system/Validation/ValidationTest.php +++ b/tests/system/Validation/ValidationTest.php @@ -640,8 +640,8 @@ public function testRunWithCustomErrorsAndAsteriskField(): void /** * @dataProvider provideRulesSetup * - * @param array|string $rules - * @param string $expected + * @param list|string $rules + * @param string $expected */ public function testRulesSetup($rules, $expected, array $errors = []): void { diff --git a/utils/Rector/PassStrictParameterToFunctionParameterRector.php b/utils/Rector/PassStrictParameterToFunctionParameterRector.php index 9e68433006ca..b7fc9b9eaee8 100644 --- a/utils/Rector/PassStrictParameterToFunctionParameterRector.php +++ b/utils/Rector/PassStrictParameterToFunctionParameterRector.php @@ -44,7 +44,7 @@ public function getRuleDefinition(): RuleDefinition } /** - * @return array + * @return list */ public function getNodeTypes(): array { diff --git a/utils/Rector/RemoveErrorSuppressInTryCatchStmtsRector.php b/utils/Rector/RemoveErrorSuppressInTryCatchStmtsRector.php index 316a97ac178e..feb697774f6f 100644 --- a/utils/Rector/RemoveErrorSuppressInTryCatchStmtsRector.php +++ b/utils/Rector/RemoveErrorSuppressInTryCatchStmtsRector.php @@ -44,7 +44,7 @@ public function getRuleDefinition(): RuleDefinition } /** - * @return array + * @return list */ public function getNodeTypes(): array { diff --git a/utils/Rector/UnderscoreToCamelCaseVariableNameRector.php b/utils/Rector/UnderscoreToCamelCaseVariableNameRector.php index ccfa751e3654..ee52be9d4366 100644 --- a/utils/Rector/UnderscoreToCamelCaseVariableNameRector.php +++ b/utils/Rector/UnderscoreToCamelCaseVariableNameRector.php @@ -79,7 +79,7 @@ public function run($aB) } /** - * @return array + * @return list */ public function getNodeTypes(): array {