From 17de539e13020b97b974074b2a241c2af3436d49 Mon Sep 17 00:00:00 2001 From: "John Paul E. Balandan, CPA" Date: Sat, 24 Feb 2024 21:58:15 +0800 Subject: [PATCH] style: enable `phpdoc_array_type` --- .php-cs-fixer.dist.php | 1 + .php-cs-fixer.no-header.php | 4 ++- .php-cs-fixer.user-guide.php | 1 + app/Config/Cache.php | 2 +- app/Config/ContentSecurityPolicy.php | 30 +++++++++---------- app/Config/Format.php | 2 +- app/Config/Toolbar.php | 2 +- app/Config/Validation.php | 2 +- app/Config/View.php | 2 +- system/API/ResponseTrait.php | 2 +- system/Autoloader/FileLocator.php | 4 +-- system/BaseModel.php | 4 +-- system/Cache/ResponseCache.php | 2 +- system/CodeIgniter.php | 2 +- system/Commands/Database/MigrateStatus.php | 2 +- .../AutoRouterImproved/AutoRouteCollector.php | 2 +- .../Utilities/Routes/ControllerFinder.php | 2 +- system/Common.php | 4 +-- system/Config/View.php | 2 +- system/Cookie/CookieStore.php | 6 ++-- system/Cookie/Exceptions/CookieException.php | 2 +- system/Database/BaseBuilder.php | 22 +++++++------- system/Database/BaseConnection.php | 12 ++++---- system/Database/BaseResult.php | 4 +-- system/Database/Forge.php | 8 ++--- system/Database/MySQLi/Connection.php | 10 +++---- system/Database/OCI8/Connection.php | 6 ++-- system/Database/Postgre/Connection.php | 6 ++-- system/Database/SQLSRV/Connection.php | 8 ++--- system/Database/SQLite3/Connection.php | 6 ++-- system/Debug/Toolbar.php | 2 +- system/Email/Email.php | 2 +- system/Events/Events.php | 4 +-- system/Files/FileCollection.php | 26 ++++++++-------- system/HTTP/Files/FileCollection.php | 2 +- system/HTTP/ResponseInterface.php | 4 +-- system/HTTP/ResponseTrait.php | 4 +-- system/Helpers/form_helper.php | 8 ++--- system/Language/Language.php | 4 +-- system/Log/Handlers/ErrorlogHandler.php | 2 +- system/Model.php | 4 +-- system/Publisher/Publisher.php | 12 ++++---- system/Router/AutoRouterImproved.php | 6 ++-- system/Router/RouteCollection.php | 2 +- system/Router/Router.php | 4 +-- system/Test/FilterTestTrait.php | 2 +- system/Test/Mock/MockCache.php | 4 +-- system/Test/Mock/MockSession.php | 2 +- system/Validation/Validation.php | 4 +-- system/Validation/ValidationInterface.php | 4 +-- tests/system/Helpers/FilesystemHelperTest.php | 2 +- tests/system/Validation/ValidationTest.php | 4 +-- ...rictParameterToFunctionParameterRector.php | 2 +- ...moveErrorSuppressInTryCatchStmtsRector.php | 2 +- ...nderscoreToCamelCaseVariableNameRector.php | 2 +- 55 files changed, 140 insertions(+), 136 deletions(-) diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php index 6a86ebe205e5..3352a832686e 100644 --- a/.php-cs-fixer.dist.php +++ b/.php-cs-fixer.dist.php @@ -44,6 +44,7 @@ ]); $overrides = [ + 'phpdoc_array_type' => true, 'phpdoc_no_alias_tag' => [ 'replacements' => [ 'type' => 'var', diff --git a/.php-cs-fixer.no-header.php b/.php-cs-fixer.no-header.php index 7c9ae1e80737..15957b5e5d00 100644 --- a/.php-cs-fixer.no-header.php +++ b/.php-cs-fixer.no-header.php @@ -29,7 +29,9 @@ __DIR__ . '/admin/starter/builds', ]); -$overrides = []; +$overrides = [ + 'phpdoc_array_type' => true, +]; $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 fe634f0a6f21..c61866e98c91 100644 --- a/.php-cs-fixer.user-guide.php +++ b/.php-cs-fixer.user-guide.php @@ -39,6 +39,7 @@ 'import_symbols' => false, 'leading_backslash_in_global_namespace' => true, ], + 'phpdoc_array_type' => true, ]; $options = [ diff --git a/app/Config/Cache.php b/app/Config/Cache.php index b5b2cdc1738f..8cae5b7732c1 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 bool|string[] + * @var array|bool */ public $cacheQueryString = false; diff --git a/app/Config/ContentSecurityPolicy.php b/app/Config/ContentSecurityPolicy.php index 7799c476f078..580c5c8b9f7e 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 string|string[]|null + * @var array|string|null */ public $defaultSrc; /** * Lists allowed scripts' URLs. * - * @var string|string[] + * @var array|string */ public $scriptSrc = 'self'; /** * Lists allowed stylesheets' URLs. * - * @var string|string[] + * @var array|string */ public $styleSrc = 'self'; /** * Defines the origins from which images can be loaded. * - * @var string|string[] + * @var array|string */ public $imageSrc = 'self'; @@ -75,14 +75,14 @@ class ContentSecurityPolicy extends BaseConfig * * Will default to self if not overridden * - * @var string|string[]|null + * @var array|string|null */ public $baseURI; /** * Lists the URLs for workers and embedded frame contents * - * @var string|string[] + * @var array|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 string|string[] + * @var array|string */ public $connectSrc = 'self'; /** * Specifies the origins that can serve web fonts. * - * @var string|string[] + * @var array|string */ public $fontSrc; /** * Lists valid endpoints for submission from `
` tags. * - * @var string|string[] + * @var array|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 string|string[]|null + * @var array|string|null */ public $frameAncestors; @@ -129,33 +129,33 @@ class ContentSecurityPolicy extends BaseConfig /** * Restricts the origins allowed to deliver video and audio. * - * @var string|string[]|null + * @var array|string|null */ public $mediaSrc; /** * Allows control over Flash and other plugins. * - * @var string|string[] + * @var array|string */ public $objectSrc = 'self'; /** - * @var string|string[]|null + * @var array|string|null */ public $manifestSrc; /** * Limits the kinds of plugins a page may invoke. * - * @var string|string[]|null + * @var array|string|null */ public $pluginTypes; /** * List of actions allowed. * - * @var string|string[]|null + * @var array|string|null */ public $sandbox; diff --git a/app/Config/Format.php b/app/Config/Format.php index 749da3e5fde2..9cf244a9fd8c 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 string[] + * @var array */ public array $supportedResponseFormats = [ 'application/json', diff --git a/app/Config/Toolbar.php b/app/Config/Toolbar.php index 97fbda281287..7758e3e85a8b 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 string[] + * @var array */ public array $collectors = [ Timers::class, diff --git a/app/Config/Validation.php b/app/Config/Validation.php index 017dac5a5841..7fb2e8e2e4d9 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 string[] + * @var array */ public array $ruleSets = [ Rules::class, diff --git a/app/Config/View.php b/app/Config/View.php index cf00863fb70b..98f8e0f602b1 100644 --- a/app/Config/View.php +++ b/app/Config/View.php @@ -56,7 +56,7 @@ class View extends BaseView * * All classes must implement CodeIgniter\View\ViewDecoratorInterface * - * @var class-string[] + * @var array> */ public array $decorators = []; } diff --git a/system/API/ResponseTrait.php b/system/API/ResponseTrait.php index 3cf0535914c4..d8b917b2054d 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 string|string[] $errors + * @param array|string $errors * * @return ResponseInterface */ diff --git a/system/Autoloader/FileLocator.php b/system/Autoloader/FileLocator.php index c5cf8e18d28b..77c34f9e9e3f 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 string[] List of file paths + * @return array 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 string[] List of file paths + * @return array List of file paths */ public function listNamespaceFiles(string $prefix, string $path): array { diff --git a/system/BaseModel.php b/system/BaseModel.php index 9cb6f969a202..b4be52f42a67 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 false|int|string[] Number of rows affected or FALSE on failure, SQL array when testMode + * @return array|false|int 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 false|int|string[] Number of rows affected or FALSE on failure, SQL array when testMode + * @return array|false|int 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 3f66284a6cf5..e59e285b6970 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 bool|string[] + * @var array|bool */ private $cacheQueryString = false; diff --git a/system/CodeIgniter.php b/system/CodeIgniter.php index a602d2a3c2f1..11541524d57b 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 string|string[]|null Route filters, that is, the filters specified in the routes file + * @return array|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 af3cbacf772c..8f8ce4d7b67a 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 string[] + * @var array */ protected $ignoredNamespaces = [ 'CodeIgniter', diff --git a/system/Commands/Utilities/Routes/AutoRouterImproved/AutoRouteCollector.php b/system/Commands/Utilities/Routes/AutoRouterImproved/AutoRouteCollector.php index 18a158cffa4f..be9ec94ec275 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 class-string[] + * @var array */ private array $protectedControllers; diff --git a/system/Commands/Utilities/Routes/ControllerFinder.php b/system/Commands/Utilities/Routes/ControllerFinder.php index 3982c454a78e..a8912aa07b13 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 class-string[] + * @return array */ public function find(): array { diff --git a/system/Common.php b/system/Common.php index e5524c039835..2b09522e0b56 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 Cookie[] $cookies If `getGlobal` is false, this is passed to CookieStore's constructor - * @param bool $getGlobal If false, creates a new instance of CookieStore + * @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 */ function cookies(array $cookies = [], bool $getGlobal = true): CookieStore { diff --git a/system/Config/View.php b/system/Config/View.php index 101b67f580d0..dff8672906b9 100644 --- a/system/Config/View.php +++ b/system/Config/View.php @@ -112,7 +112,7 @@ class View extends BaseConfig * * All classes must implement CodeIgniter\View\ViewDecoratorInterface * - * @var class-string[] + * @var array> */ public array $decorators = []; diff --git a/system/Cookie/CookieStore.php b/system/Cookie/CookieStore.php index d893a4add116..99c1dd9fff66 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 string[] $headers + * @param array $headers * * @return static * @@ -44,7 +44,7 @@ class CookieStore implements Countable, IteratorAggregate public static function fromCookieHeaders(array $headers, bool $raw = false) { /** - * @var Cookie[] $cookies + * @var array $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 Cookie[] $cookies + * @param array $cookies * * @throws CookieException */ diff --git a/system/Cookie/Exceptions/CookieException.php b/system/Cookie/Exceptions/CookieException.php index 2e69a0e0f891..0b18d9eb8356 100644 --- a/system/Cookie/Exceptions/CookieException.php +++ b/system/Cookie/Exceptions/CookieException.php @@ -116,7 +116,7 @@ public static function forInvalidCookieInstance(array $data) /** * Thrown when the queried Cookie object does not exist in the cookie collection. * - * @param string[] $data + * @param array $data * * @return static */ diff --git a/system/Database/BaseBuilder.php b/system/Database/BaseBuilder.php index bc005f48f407..d6fc3aa6262c 100644 --- a/system/Database/BaseBuilder.php +++ b/system/Database/BaseBuilder.php @@ -281,14 +281,14 @@ class BaseBuilder /** * Strings that determine if a string represents a literal value or a field name * - * @var string[] + * @var array */ protected $isLiteralStr = []; /** * RegExp used to get operators * - * @var string[] + * @var array */ 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 false|int|string[] Number of rows inserted or FALSE on failure, SQL array when testMode + * @return array|false|int 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 false|int|string[] Number of affected rows or FALSE on failure, SQL array when testMode + * @return array|false|int 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 false|int|string[] Number of affected rows or FALSE on failure, SQL array when testMode + * @return array|false|int 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 RawSql[]|string|string[] $set - * @param bool $addToDefault adds update fields to the default ones - * @param array|null $ignore ignores items in set + * @param array|array|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 false|int|string[] Number of rows inserted or FALSE on failure, SQL array when testMode + * @return array|false|int 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 false|int|string[] Number of rows affected or FALSE on failure, SQL array when testMode + * @return array|false|int 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 false|int|string[] Number of rows affected or FALSE on failure, SQL array when testMode + * @return array|false|int 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 4e34e0fdb699..289aa422bc2d 100644 --- a/system/Database/BaseConnection.php +++ b/system/Database/BaseConnection.php @@ -1279,10 +1279,10 @@ public function escape($str) /** * Escape String * - * @param string|string[] $str Input string - * @param bool $like Whether or not the string will be used in a LIKE condition + * @param array|string $str Input string + * @param bool $like Whether or not the string will be used in a LIKE condition * - * @return string|string[] + * @return array|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 string|string[] $str + * @param array|string $str * - * @return string|string[] + * @return array|string */ public function escapeLikeString($str) { @@ -1517,7 +1517,7 @@ public function fieldExists(string $fieldName, string $tableName): bool /** * Returns an object with field data * - * @return stdClass[] + * @return array */ public function getFieldData(string $table) { diff --git a/system/Database/BaseResult.php b/system/Database/BaseResult.php index d7b32218322b..30352fba65ed 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 array */ public $resultArray = []; /** * Result Object * - * @var object[] + * @var array */ public $resultObject = []; diff --git a/system/Database/Forge.php b/system/Database/Forge.php index afc7d1cd6b15..c2659a88ce0e 100644 --- a/system/Database/Forge.php +++ b/system/Database/Forge.php @@ -39,7 +39,7 @@ class Forge /** * List of keys. * - * @var list + * @var list, keyName?: string}> */ protected $keys = []; @@ -53,7 +53,7 @@ class Forge /** * Primary keys. * - * @var array{fields?: string[], keyName?: string} + * @var array{fields?: array, keyName?: string} */ protected $primaryKeys = []; @@ -399,8 +399,8 @@ public function addField($fields) /** * Add Foreign Key * - * @param string|string[] $fieldName - * @param string|string[] $tableField + * @param array|string $fieldName + * @param array|string $tableField * * @throws DatabaseException */ diff --git a/system/Database/MySQLi/Connection.php b/system/Database/MySQLi/Connection.php index 3139185f1bc4..74d296c70036 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 string|string[] $str Input string + * @param array|string $str Input string * - * @return string|string[] + * @return array|string */ public function escapeLikeStringDirect($str) { @@ -411,7 +411,7 @@ protected function _listColumns(string $table = ''): string /** * Returns an array of objects with field data * - * @return stdClass[] + * @return array * * @throws DatabaseException */ @@ -443,7 +443,7 @@ protected function _fieldData(string $table): array /** * Returns an array of objects with index data * - * @return stdClass[] + * @return array * * @throws DatabaseException * @throws LogicException @@ -489,7 +489,7 @@ protected function _indexData(string $table): array /** * Returns an array of objects with Foreign key data * - * @return stdClass[] + * @return array * * @throws DatabaseException */ diff --git a/system/Database/OCI8/Connection.php b/system/Database/OCI8/Connection.php index 5d239f171733..beb3ba00c039 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 stdClass[] + * @return array * * @throws DatabaseException */ @@ -325,7 +325,7 @@ protected function _fieldData(string $table): array /** * Returns an array of objects with index data * - * @return stdClass[] + * @return array * * @throws DatabaseException */ @@ -374,7 +374,7 @@ protected function _indexData(string $table): array /** * Returns an array of objects with Foreign key data * - * @return stdClass[] + * @return array * * @throws DatabaseException */ diff --git a/system/Database/Postgre/Connection.php b/system/Database/Postgre/Connection.php index 64c24adb0244..d05d564812a2 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 stdClass[] + * @return array * * @throws DatabaseException */ @@ -329,7 +329,7 @@ protected function _fieldData(string $table): array /** * Returns an array of objects with index data * - * @return stdClass[] + * @return array * * @throws DatabaseException */ @@ -368,7 +368,7 @@ protected function _indexData(string $table): array /** * Returns an array of objects with Foreign key data * - * @return stdClass[] + * @return array * * @throws DatabaseException */ diff --git a/system/Database/SQLSRV/Connection.php b/system/Database/SQLSRV/Connection.php index aa45a4ba0a24..f6ba6fffaba6 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 string[] + * @var array */ protected $_reserved_identifiers = ['*']; @@ -231,7 +231,7 @@ protected function _listColumns(string $table = ''): string /** * Returns an array of objects with index data * - * @return stdClass[] + * @return array * * @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 stdClass[] + * @return array * * @throws DatabaseException */ @@ -335,7 +335,7 @@ protected function _enableForeignKeyChecks() /** * Returns an array of objects with field data * - * @return stdClass[] + * @return array * * @throws DatabaseException */ diff --git a/system/Database/SQLite3/Connection.php b/system/Database/SQLite3/Connection.php index 18760699a391..1e38ee5d3ae7 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 stdClass[] + * @return array * * @throws DatabaseException */ @@ -286,7 +286,7 @@ protected function _fieldData(string $table): array /** * Returns an array of objects with index data * - * @return stdClass[] + * @return array * * @throws DatabaseException */ @@ -343,7 +343,7 @@ protected function _indexData(string $table): array /** * Returns an array of objects with Foreign key data * - * @return stdClass[] + * @return array */ protected function _foreignKeyData(string $table): array { diff --git a/system/Debug/Toolbar.php b/system/Debug/Toolbar.php index 1a8faaf399ba..7e8a73fadb68 100644 --- a/system/Debug/Toolbar.php +++ b/system/Debug/Toolbar.php @@ -43,7 +43,7 @@ class Toolbar /** * Collectors to be used and displayed. * - * @var BaseCollector[] + * @var array */ protected $collectors = []; diff --git a/system/Email/Email.php b/system/Email/Email.php index 183ac945047c..bac2b5682d05 100644 --- a/system/Email/Email.php +++ b/system/Email/Email.php @@ -296,7 +296,7 @@ class Email /** * Raw debug messages * - * @var string[] + * @var array */ private array $debugMessageRaw = []; diff --git a/system/Events/Events.php b/system/Events/Events.php index b240dc29e1ca..c8f65e9cb360 100644 --- a/system/Events/Events.php +++ b/system/Events/Events.php @@ -59,7 +59,7 @@ class Events /** * A list of found files. * - * @var string[] + * @var array */ protected static $files = []; @@ -253,7 +253,7 @@ public static function setFiles(array $files) /** * Returns the files that were found/loaded during this request. * - * @return string[] + * @return array */ public static function getFiles() { diff --git a/system/Files/FileCollection.php b/system/Files/FileCollection.php index 87f987eb8f1e..ad24d708ea00 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 string[] + * @var array */ 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 string[] $files + * @param array $files * - * @return string[] + * @return array */ 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 string[] $files - * @param string $pattern Regex or pseudo-regex string + * @param array $files + * @param string $pattern Regex or pseudo-regex string * - * @return string[] + * @return array */ 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 string[] $files + * @param array $files */ public function __construct(array $files = []) { @@ -136,7 +136,7 @@ protected function define(): void /** * Optimizes and returns the current file list. * - * @return string[] + * @return array */ 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 string[] $files The new file list to use + * @param array $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 string|string[] $paths + * @param array|string $paths * * @return $this */ @@ -199,7 +199,7 @@ public function add($paths, bool $recursive = true) /** * Verifies and adds files to the list. * - * @param string[] $files + * @param array $files * * @return $this */ @@ -227,7 +227,7 @@ public function addFile(string $file) /** * Removes files from the list. * - * @param string[] $files + * @param array $files * * @return $this */ @@ -256,7 +256,7 @@ public function removeFile(string $file) * Verifies and adds files from each * directory to the list. * - * @param string[] $directories + * @param array $directories * * @return $this */ diff --git a/system/HTTP/Files/FileCollection.php b/system/HTTP/Files/FileCollection.php index 124381ec33bb..9edf1be9c16e 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 UploadedFile|UploadedFile[] + * @return array|UploadedFile */ protected function createFileObject(array $array) { diff --git a/system/HTTP/ResponseInterface.php b/system/HTTP/ResponseInterface.php index a6d41c77be3c..0f76b000d5c2 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 Cookie|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 Cookie[] + * @return array */ public function getCookies(); diff --git a/system/HTTP/ResponseTrait.php b/system/HTTP/ResponseTrait.php index b385bfea45de..8a6de1f9dd9c 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 Cookie|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 Cookie[] + * @return array */ public function getCookies() { diff --git a/system/Helpers/form_helper.php b/system/Helpers/form_helper.php index b8ad34770464..a9c348c82f23 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 string|string[] $default Default value - * @param bool $htmlEscape Whether to escape HTML special characters or not + * @param string $field Field name + * @param array|string $default Default value + * @param bool $htmlEscape Whether to escape HTML special characters or not * - * @return string|string[] + * @return array|string */ function set_value(string $field, $default = '', bool $htmlEscape = true) { diff --git a/system/Language/Language.php b/system/Language/Language.php index 8633f8a2dd9c..c43c7a0d5c12 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 string[] $args + * @param array|string $message + * @param array $args * * @return array|string */ diff --git a/system/Log/Handlers/ErrorlogHandler.php b/system/Log/Handlers/ErrorlogHandler.php index d9f3fc4e0a20..f56b7a8e9a43 100644 --- a/system/Log/Handlers/ErrorlogHandler.php +++ b/system/Log/Handlers/ErrorlogHandler.php @@ -43,7 +43,7 @@ class ErrorlogHandler extends BaseHandler /** * Constructor. * - * @param mixed[] $config + * @param array $config */ public function __construct(array $config = []) { diff --git a/system/Model.php b/system/Model.php index 2596417c12e6..abc8e725ece9 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 string[] method name + * @var array 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 false|int|string[] Number of rows affected or FALSE on failure, SQL array when testMode + * @return array|false|int 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 e40a14c88905..501329e36a6b 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 + * @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 string[] + * @var array */ private array $published = []; @@ -95,7 +95,7 @@ class Publisher extends FileCollection /** * Discovers and returns all Publishers in the specified namespace directory. * - * @return self[] + * @return array */ 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 string[] + * @return array */ final public function getPublished(): array { @@ -266,7 +266,7 @@ final public function getPublished(): array /** * Verifies and adds paths to the list. * - * @param string[] $paths + * @param array $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 string[] $uris + * @param array $uris * * @return $this */ diff --git a/system/Router/AutoRouterImproved.php b/system/Router/AutoRouterImproved.php index a86e92f0161a..8c418df1583d 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 class-string[] + * @var array */ private array $protectedControllers; @@ -100,8 +100,8 @@ final class AutoRouterImproved implements AutoRouterInterface private ?int $paramPos = null; /** - * @param class-string[] $protectedControllers - * @param string $defaultController Short classname + * @param array $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 8df31c9073bb..11fe54157160 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 string|string[] $subdomains + * @param array|string $subdomains */ private function checkSubdomains($subdomains): bool { diff --git a/system/Router/Router.php b/system/Router/Router.php index 634f3e61a035..34d172360c3d 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 string[] + * @var array */ protected $filtersInfo = []; @@ -228,7 +228,7 @@ public function getFilter() /** * Returns the filter info for the matched route, if any. * - * @return string[] + * @return array */ public function getFilters(): array { diff --git a/system/Test/FilterTestTrait.php b/system/Test/FilterTestTrait.php index 523717e54679..2ec0563595db 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 string[] The filter aliases + * @return array 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 082807b559ec..30bbd18f8be6 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 ?int[] + * @var ?array */ protected $expirations = []; @@ -203,7 +203,7 @@ public function clean() * The information returned and the structure of the data * varies depending on the handler. * - * @return string[] Keys currently present in the store + * @return array Keys currently present in the store */ public function getCacheInfo() { diff --git a/system/Test/Mock/MockSession.php b/system/Test/Mock/MockSession.php index 9f558e1034ad..63339788d084 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 Cookie[] + * @var array */ public $cookies = []; diff --git a/system/Validation/Validation.php b/system/Validation/Validation.php index 83bb361e7017..4101c41ce898 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 string[] $errors The custom error message. + * @param array $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 string[] Rule group. + * @return array Rule group. * * @throws ValidationException If group not found. */ diff --git a/system/Validation/ValidationInterface.php b/system/Validation/ValidationInterface.php index c289afc4541d..9bde5c2a4873 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 string[] $errors + * @param array $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 string[] Rule group. + * @return array Rule group. */ public function getRuleGroup(string $group): array; diff --git a/tests/system/Helpers/FilesystemHelperTest.php b/tests/system/Helpers/FilesystemHelperTest.php index 987e11eb5dcb..7f7c15dc323d 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 bb8ece43dd86..6d3214549082 100644 --- a/tests/system/Validation/ValidationTest.php +++ b/tests/system/Validation/ValidationTest.php @@ -640,8 +640,8 @@ public function testRunWithCustomErrorsAndAsteriskField(): void /** * @dataProvider provideRulesSetup * - * @param string|string[] $rules - * @param string $expected + * @param array|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 14b1a840e60b..9e68433006ca 100644 --- a/utils/Rector/PassStrictParameterToFunctionParameterRector.php +++ b/utils/Rector/PassStrictParameterToFunctionParameterRector.php @@ -44,7 +44,7 @@ public function getRuleDefinition(): RuleDefinition } /** - * @return string[] + * @return array */ public function getNodeTypes(): array { diff --git a/utils/Rector/RemoveErrorSuppressInTryCatchStmtsRector.php b/utils/Rector/RemoveErrorSuppressInTryCatchStmtsRector.php index 5bdd8ed8bb7b..316a97ac178e 100644 --- a/utils/Rector/RemoveErrorSuppressInTryCatchStmtsRector.php +++ b/utils/Rector/RemoveErrorSuppressInTryCatchStmtsRector.php @@ -44,7 +44,7 @@ public function getRuleDefinition(): RuleDefinition } /** - * @return string[] + * @return array */ public function getNodeTypes(): array { diff --git a/utils/Rector/UnderscoreToCamelCaseVariableNameRector.php b/utils/Rector/UnderscoreToCamelCaseVariableNameRector.php index 23035e7bee46..ccfa751e3654 100644 --- a/utils/Rector/UnderscoreToCamelCaseVariableNameRector.php +++ b/utils/Rector/UnderscoreToCamelCaseVariableNameRector.php @@ -79,7 +79,7 @@ public function run($aB) } /** - * @return string[] + * @return array */ public function getNodeTypes(): array {