diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php index 3653cf1349c2..474ae5d8a8ee 100644 --- a/.php-cs-fixer.dist.php +++ b/.php-cs-fixer.dist.php @@ -43,7 +43,27 @@ __DIR__ . '/spark', ]); -$overrides = []; +$overrides = [ + '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', + 'property', + 'return', + 'throws', + 'type', + 'var', + ], + ], +]; $options = [ 'cacheFile' => 'build/.php-cs-fixer.cache', diff --git a/.php-cs-fixer.no-header.php b/.php-cs-fixer.no-header.php index 7c9ae1e80737..a144a886c50a 100644 --- a/.php-cs-fixer.no-header.php +++ b/.php-cs-fixer.no-header.php @@ -29,7 +29,27 @@ __DIR__ . '/admin/starter/builds', ]); -$overrides = []; +$overrides = [ + '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', + 'property', + 'return', + 'throws', + 'type', + 'var', + ], + ], +]; $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..50cec42c6448 100644 --- a/.php-cs-fixer.user-guide.php +++ b/.php-cs-fixer.user-guide.php @@ -39,6 +39,25 @@ 'import_symbols' => false, 'leading_backslash_in_global_namespace' => 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', + 'property', + 'return', + 'throws', + 'type', + 'var', + ], + ], ]; $options = [ diff --git a/system/BaseModel.php b/system/BaseModel.php index 6a6f0dff4dd2..8f04270b20f9 100644 --- a/system/BaseModel.php +++ b/system/BaseModel.php @@ -400,7 +400,7 @@ abstract protected function doFirst(); * Inserts data into the current database. * This method works only with dbCalls. * - * @param array $row Row data + * @param array $row Row data * @phpstan-param row_array $row * * @return bool @@ -424,9 +424,9 @@ abstract protected function doInsertBatch(?array $set = null, ?bool $escape = nu * Updates a single record in the database. * This method works only with dbCalls. * - * @param array|int|string|null $id ID - * @param array|null $row Row data - * @phpstan-param row_array|null $row + * @param array|int|string|null $id ID + * @param array|null $row Row data + * @phpstan-param row_array|null $row */ abstract protected function doUpdate($id = null, $row = null): bool; @@ -480,9 +480,9 @@ abstract protected function doOnlyDeleted(); * Compiles a replace and runs the query. * This method works only with dbCalls. * - * @param array|null $row Row data + * @param array|null $row Row data * @phpstan-param row_array|null $row - * @param bool $returnSQL Set to true to return Query String + * @param bool $returnSQL Set to true to return Query String * * @return BaseResult|false|Query|string */ @@ -511,7 +511,7 @@ abstract protected function idValue($data); * Public getter to return the id value using the idValue() method. * For example with SQL this will return $data->$this->primaryKey. * - * @param array|object $row Row data + * @param array|object $row Row data * @phpstan-param row_array|object $row * * @return array|int|string|null @@ -552,7 +552,7 @@ abstract public function chunk(int $size, Closure $userFunc); * * @param array|int|string|null $id One primary key or an array of primary keys * - * @return array|object|null The resulting row of data, or null. + * @return array|object|null The resulting row of data, or null. * @phpstan-return ($id is int|string ? row_array|object|null : list) */ public function find($id = null) @@ -696,7 +696,7 @@ public function first() * you must ensure that the class will provide access to the class * variables, even if through a magic method. * - * @param array|object $row Row data + * @param array|object $row Row data * @phpstan-param row_array|object $row * * @throws ReflectionException @@ -724,7 +724,7 @@ public function save($row): bool * This method is called on save to determine if entry have to be updated. * If this method returns false insert operation will be executed * - * @param array|object $row Row data + * @param array|object $row Row data * @phpstan-param row_array|object $row */ protected function shouldUpdate($row): bool @@ -748,11 +748,11 @@ public function getInsertID() * Inserts data into the database. If an object is provided, * it will attempt to convert it to an array. * - * @param array|object|null $row Row data + * @param array|object|null $row Row data * @phpstan-param row_array|object|null $row - * @param bool $returnID Whether insert ID should be returned or not. + * @param bool $returnID Whether insert ID should be returned or not. * - * @return bool|int|string insert ID or true on success. false on failure. + * @return bool|int|string insert ID or true on success. false on failure. * @phpstan-return ($returnID is true ? int|string|false : bool) * * @throws ReflectionException @@ -826,8 +826,8 @@ public function insert($row = null, bool $returnID = true) /** * Set datetime to created field. * - * @phpstan-param row_array $row - * @param int|string $date timestamp or datetime string + * @phpstan-param row_array $row + * @param int|string $date timestamp or datetime string */ protected function setCreatedField(array $row, $date): array { @@ -841,8 +841,8 @@ protected function setCreatedField(array $row, $date): array /** * Set datetime to updated field. * - * @phpstan-param row_array $row - * @param int|string $date timestamp or datetime string + * @phpstan-param row_array $row + * @param int|string $date timestamp or datetime string */ protected function setUpdatedField(array $row, $date): array { @@ -856,11 +856,11 @@ protected function setUpdatedField(array $row, $date): array /** * Compiles batch insert runs the queries, validating each row prior. * - * @param list|null $set an associative array of insert values + * @param list|null $set an associative array of insert values * @phpstan-param list|null $set - * @param bool|null $escape Whether to escape values - * @param int $batchSize The size of the batch to run - * @param bool $testing True means only number of records is returned, false will execute the query + * @param bool|null $escape Whether to escape values + * @param int $batchSize The size of the batch to run + * @param bool $testing True means only number of records is returned, false will execute the query * * @return bool|int Number of rows inserted or FALSE on failure * @@ -937,8 +937,8 @@ public function insertBatch(?array $set = null, ?bool $escape = null, int $batch * Updates a single record in the database. If an object is provided, * it will attempt to convert it into an array. * - * @param array|int|string|null $id - * @param array|object|null $row Row data + * @param array|int|string|null $id + * @param array|object|null $row Row data * @phpstan-param row_array|object|null $row * * @throws ReflectionException @@ -999,11 +999,11 @@ public function update($id = null, $row = null): bool /** * Compiles an update and runs the query. * - * @param list|null $set an associative array of insert values + * @param list|null $set an associative array of insert values * @phpstan-param list|null $set - * @param string|null $index The where key - * @param int $batchSize The size of the batch to run - * @param bool $returnSQL True means SQL is returned, false will execute the query + * @param string|null $index The where key + * @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 * @@ -1173,9 +1173,9 @@ public function onlyDeleted() /** * Compiles a replace and runs the query. * - * @param array|null $row Row data + * @param array|null $row Row data * @phpstan-param row_array|null $row - * @param bool $returnSQL Set to true to return Query String + * @param bool $returnSQL Set to true to return Query String * * @return BaseResult|false|Query|string */ @@ -1279,7 +1279,7 @@ public function protect(bool $protect = true) * @used-by update() to protect against mass assignment vulnerabilities. * @used-by updateBatch() to protect against mass assignment vulnerabilities. * - * @param array $row Row data + * @param array $row Row data * @phpstan-param row_array $row * * @throws DataException @@ -1310,7 +1310,7 @@ protected function doProtectFields(array $row): array * @used-by insert() to protect against mass assignment vulnerabilities. * @used-by insertBatch() to protect against mass assignment vulnerabilities. * - * @param array $row Row data + * @param array $row Row data * @phpstan-param row_array $row * * @throws DataException @@ -1505,7 +1505,7 @@ public function cleanRules(bool $choice = false) * Validate the row data against the validation rules (or the validation group) * specified in the class property, $validationRules. * - * @param array|object $row Row data + * @param array|object $row Row data * @phpstan-param row_array|object $row */ public function validate($row): bool @@ -1575,8 +1575,8 @@ public function getValidationMessages(): array * currently so that rules don't block updating when only updating * a partial row. * - * @param array $rules Array containing field name and rule - * @param array $row Row data (@TODO Remove null in param type) + * @param array $rules Array containing field name and rule + * @param array $row Row data (@TODO Remove null in param type) * @phpstan-param row_array $row */ protected function cleanValidationRules(array $rules, ?array $row = null): array @@ -1760,9 +1760,9 @@ protected function objectToRawArray($object, bool $onlyChanged = true, bool $rec /** * Transform data to array. * - * @param array|object|null $row Row data + * @param array|object|null $row Row data * @phpstan-param row_array|object|null $row - * @param string $type Type of data (insert|update) + * @param string $type Type of data (insert|update) * * @throws DataException * @throws InvalidArgumentException diff --git a/system/Common.php b/system/Common.php index 690fa3fc5b6a..e5524c039835 100644 --- a/system/Common.php +++ b/system/Common.php @@ -64,7 +64,7 @@ function app_timezone(): string * cache()->save('foo', 'bar'); * $foo = cache('bar'); * - * @return array|bool|CacheInterface|float|int|object|string|null + * @return array|bool|CacheInterface|float|int|object|string|null * @phpstan-return ($key is null ? CacheInterface : array|bool|float|int|object|string|null) */ function cache(?string $key = null) @@ -207,7 +207,7 @@ function command(string $command) * * @param class-string|string $name * - * @return ConfigTemplate|null + * @return ConfigTemplate|null * @phpstan-return ($name is class-string ? ConfigTemplate : object|null) */ function config(string $name, bool $getShared = true) @@ -414,11 +414,11 @@ 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 $data + * @param array|string $data * @phpstan-param 'html'|'js'|'css'|'url'|'attr'|'raw' $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 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 array|string * @@ -805,7 +805,7 @@ function log_message(string $level, string $message, array $context = []) * * @param class-string|string $name * - * @return ModelTemplate|null + * @return ModelTemplate|null * @phpstan-return ($name is class-string ? ModelTemplate : object|null) */ function model(string $name, bool $getShared = true, ?ConnectionInterface &$conn = null) @@ -819,8 +819,8 @@ function model(string $name, bool $getShared = true, ?ConnectionInterface &$conn * Provides access to "old input" that was set in the session * during a redirect()->withInput(). * - * @param string|null $default - * @param false|string $escape + * @param string|null $default + * @param false|string $escape * @phpstan-param false|'attr'|'css'|'html'|'js'|'raw'|'url' $escape * * @return array|string|null @@ -974,7 +974,7 @@ function route_to(string $method, ...$params) * session()->set('foo', 'bar'); * $foo = session('bar'); * - * @return array|bool|float|int|object|Session|string|null + * @return array|bool|float|int|object|Session|string|null * @phpstan-return ($val is null ? Session : array|bool|float|int|object|string|null) */ function session(?string $val = null) @@ -1128,7 +1128,7 @@ function stringify_attributes($attributes, bool $js = false): string * @param non-empty-string|null $name * @param (callable(): mixed)|null $callable * - * @return mixed|Timer + * @return mixed|Timer * @phpstan-return ($name is null ? Timer : ($callable is (callable(): mixed) ? mixed : Timer)) */ function timer(?string $name = null, ?callable $callable = null) diff --git a/system/Database/BaseConnection.php b/system/Database/BaseConnection.php index 1116d3966439..a024d938f386 100644 --- a/system/Database/BaseConnection.php +++ b/system/Database/BaseConnection.php @@ -457,7 +457,7 @@ abstract protected function _close(); /** * Create a persistent database connection. * - * @return false|object|resource + * @return false|object|resource * @phpstan-return false|TConnection */ public function persistentConnect() @@ -471,7 +471,7 @@ public function persistentConnect() * get that connection. If you pass either alias in and only a single * connection is present, it must return the sole connection. * - * @return false|object|resource + * @return false|object|resource * @phpstan-return TConnection */ public function getConnection(?string $alias = null) @@ -547,7 +547,7 @@ public function addTableAlias(string $table) /** * Executes the query against the database. * - * @return false|object|resource + * @return false|object|resource * @phpstan-return false|TResult */ abstract protected function execute(string $sql); @@ -562,7 +562,7 @@ abstract protected function execute(string $sql); * * @param array|string|null $binds * - * @return BaseResult|bool|Query BaseResult when “read” type query, bool when “write” type query, Query when prepared query + * @return BaseResult|bool|Query BaseResult when “read” type query, bool when “write” type query, Query when prepared query * @phpstan-return BaseResult|bool|Query * * @todo BC set $queryClass default as null in 4.1 @@ -681,7 +681,7 @@ public function query(string $sql, $binds = null, bool $setEscapeFlags = true, s * is performed, nor are transactions handled. Simply takes a raw * query string and returns the database-specific result id. * - * @return false|object|resource + * @return false|object|resource * @phpstan-return false|TResult */ public function simpleQuery(string $sql) @@ -1006,7 +1006,7 @@ public function getConnectDuration(int $decimals = 6): string * @param bool $protectIdentifiers Protect table or column names? * @param bool $fieldExists Supplied $item contains a column name? * - * @return array|string + * @return array|string * @phpstan-return ($item is array ? array : string) */ public function protectIdentifiers($item, bool $prefixSingle = false, ?bool $protectIdentifiers = null, bool $fieldExists = true) @@ -1166,7 +1166,7 @@ private function protectDotItem(string $item, string $alias, bool $protectIdenti * * @param array|string $item * - * @return array|string + * @return array|string * @phpstan-return ($item is array ? array : string) */ public function escapeIdentifiers($item) @@ -1251,7 +1251,7 @@ abstract public function affectedRows(): int; * * @param array|bool|float|int|object|string|null $str * - * @return array|float|int|string + * @return array|float|int|string * @phpstan-return ($str is array ? array : float|int|string) */ public function escape($str) @@ -1665,7 +1665,7 @@ public function isWriteType($sql): bool * * Must return an array with keys 'code' and 'message': * - * @return array + * @return array * @phpstan-return array{code: int|string|null, message: string|null} */ abstract public function error(): array; diff --git a/system/Database/BasePreparedQuery.php b/system/Database/BasePreparedQuery.php index bfc0a608ea05..4e9d816686f9 100644 --- a/system/Database/BasePreparedQuery.php +++ b/system/Database/BasePreparedQuery.php @@ -110,7 +110,7 @@ abstract public function _prepare(string $sql, array $options = []); * Takes a new set of data and runs it against the currently * prepared query. Upon success, will return a Results object. * - * @return bool|ResultInterface + * @return bool|ResultInterface * @phpstan-return bool|ResultInterface * * @throws DatabaseException diff --git a/system/Database/BaseResult.php b/system/Database/BaseResult.php index b807b0bb7ff0..93bb00e4d350 100644 --- a/system/Database/BaseResult.php +++ b/system/Database/BaseResult.php @@ -83,10 +83,10 @@ abstract class BaseResult implements ResultInterface /** * Constructor * - * @param object|resource $connID - * @param object|resource $resultID - * @phpstan-param TConnection $connID - * @phpstan-param TResult $resultID + * @param object|resource $connID + * @param object|resource $resultID + * @phpstan-param TConnection $connID + * @phpstan-param TResult $resultID */ public function __construct(&$connID, &$resultID) { @@ -209,7 +209,7 @@ public function getResultArray(): array * * If no results, an empty array is returned. * - * @return array + * @return array * @phpstan-return list */ public function getResultObject(): array @@ -254,11 +254,11 @@ public function getResultObject(): array * * If row doesn't exist, returns null. * - * @param int|string $n The index of the results to return, or column name. - * @param string $type The type of result object. 'array', 'object' or class name. + * @param int|string $n The index of the results to return, or column name. + * @param string $type The type of result object. 'array', 'object' or class name. * @phpstan-param class-string|'array'|'object' $type * - * @return array|object|stdClass|null + * @return array|object|stdClass|null * @phpstan-return ($type is 'object' ? stdClass|null : ($type is 'array' ? array|null : object|null)) */ public function getRow($n = 0, string $type = 'object') diff --git a/system/Database/ConnectionInterface.php b/system/Database/ConnectionInterface.php index 85125eb1ae62..a8493f897ec7 100644 --- a/system/Database/ConnectionInterface.php +++ b/system/Database/ConnectionInterface.php @@ -27,7 +27,7 @@ public function initialize(); /** * Connect to the database. * - * @return false|object|resource + * @return false|object|resource * @phpstan-return false|TConnection */ public function connect(bool $persistent = false); @@ -35,7 +35,7 @@ public function connect(bool $persistent = false); /** * Create a persistent database connection. * - * @return false|object|resource + * @return false|object|resource * @phpstan-return false|TConnection */ public function persistentConnect(); @@ -54,7 +54,7 @@ public function reconnect(); * get that connection. If you pass either alias in and only a single * connection is present, it must return the sole connection. * - * @return false|object|resource + * @return false|object|resource * @phpstan-return false|TConnection */ public function getConnection(?string $alias = null); @@ -100,7 +100,7 @@ public function getVersion(): string; * * @param array|string|null $binds * - * @return BaseResult|bool|Query + * @return BaseResult|bool|Query * @phpstan-return BaseResult|bool|Query */ public function query(string $sql, $binds = null); @@ -110,7 +110,7 @@ public function query(string $sql, $binds = null); * is performed, nor are transactions handled. Simply takes a raw * query string and returns the database-specific result id. * - * @return false|object|resource + * @return false|object|resource * @phpstan-return false|TResult */ public function simpleQuery(string $sql); @@ -139,7 +139,7 @@ public function getLastQuery(); * * @param array|bool|float|int|object|string|null $str * - * @return array|float|int|string + * @return array|float|int|string * @phpstan-return ($str is array ? array : float|int|string) */ public function escape($str); diff --git a/system/Database/Forge.php b/system/Database/Forge.php index adbdc208fc47..afc7d1cd6b15 100644 --- a/system/Database/Forge.php +++ b/system/Database/Forge.php @@ -831,7 +831,7 @@ public function modifyColumn(string $table, $fields): bool * @param array|string $processedFields Processed column definitions * or column names to DROP * - * @return false|list|string|null SQL string + * @return false|list|string|null SQL string * @phpstan-return ($alterType is 'DROP' ? string : list|false|null) */ protected function _alterTable(string $alterType, string $table, $processedFields) diff --git a/system/Database/MySQLi/Forge.php b/system/Database/MySQLi/Forge.php index b1beba2a9dd2..adc6c6cc7267 100644 --- a/system/Database/MySQLi/Forge.php +++ b/system/Database/MySQLi/Forge.php @@ -133,7 +133,7 @@ protected function _createTableAttributes(array $attributes): string * @param array|string $processedFields Processed column definitions * or column names to DROP * - * @return list|string SQL string + * @return list|string SQL string * @phpstan-return ($alterType is 'DROP' ? string : list) */ protected function _alterTable(string $alterType, string $table, $processedFields) diff --git a/system/Database/OCI8/Forge.php b/system/Database/OCI8/Forge.php index 2735b886cb86..4de36ac91e6d 100644 --- a/system/Database/OCI8/Forge.php +++ b/system/Database/OCI8/Forge.php @@ -98,7 +98,7 @@ class Forge extends BaseForge * @param array|string $processedFields Processed column definitions * or column names to DROP * - * @return list|string SQL string + * @return list|string SQL string * @phpstan-return ($alterType is 'DROP' ? string : list) */ protected function _alterTable(string $alterType, string $table, $processedFields) diff --git a/system/Database/Postgre/Connection.php b/system/Database/Postgre/Connection.php index 56905ec922d2..c54209453217 100644 --- a/system/Database/Postgre/Connection.php +++ b/system/Database/Postgre/Connection.php @@ -55,7 +55,7 @@ class Connection extends BaseConnection /** * Connect to the database. * - * @return false|resource + * @return false|resource * @phpstan-return false|PgSqlConnection */ public function connect(bool $persistent = false) @@ -178,7 +178,7 @@ public function getVersion(): string /** * Executes the query against the database. * - * @return false|resource + * @return false|resource * @phpstan-return false|PgSqlResult */ protected function execute(string $sql) @@ -219,7 +219,7 @@ public function affectedRows(): int * * @param array|bool|float|int|object|string|null $str * - * @return array|float|int|string + * @return array|float|int|string * @phpstan-return ($str is array ? array : float|int|string) */ public function escape($str) diff --git a/system/Database/Postgre/Forge.php b/system/Database/Postgre/Forge.php index ee7583642684..8af1507c6b2a 100644 --- a/system/Database/Postgre/Forge.php +++ b/system/Database/Postgre/Forge.php @@ -84,7 +84,7 @@ protected function _createTableAttributes(array $attributes): string * @param array|string $processedFields Processed column definitions * or column names to DROP * - * @return false|list|string SQL string or false + * @return false|list|string SQL string or false * @phpstan-return ($alterType is 'DROP' ? string : list|false) */ protected function _alterTable(string $alterType, string $table, $processedFields) diff --git a/system/Database/Postgre/PreparedQuery.php b/system/Database/Postgre/PreparedQuery.php index fd60793dbe5d..d47b72d639d7 100644 --- a/system/Database/Postgre/PreparedQuery.php +++ b/system/Database/Postgre/PreparedQuery.php @@ -93,7 +93,7 @@ public function _execute(array $data): bool /** * Returns the result object for the prepared query or false on failure. * - * @return resource|null + * @return resource|null * @phpstan-return PgSqlResult|null */ public function _getResult() diff --git a/system/Database/PreparedQueryInterface.php b/system/Database/PreparedQueryInterface.php index 7b55991835c8..b5d00ef11e19 100644 --- a/system/Database/PreparedQueryInterface.php +++ b/system/Database/PreparedQueryInterface.php @@ -24,7 +24,7 @@ interface PreparedQueryInterface * Takes a new set of data and runs it against the currently * prepared query. Upon success, will return a Results object. * - * @return bool|ResultInterface + * @return bool|ResultInterface * @phpstan-return bool|ResultInterface */ public function execute(...$data); diff --git a/system/Database/ResultInterface.php b/system/Database/ResultInterface.php index b06de85ad3be..82cb7956b22e 100644 --- a/system/Database/ResultInterface.php +++ b/system/Database/ResultInterface.php @@ -57,11 +57,11 @@ public function getResultObject(): array; * * If row doesn't exist, returns null. * - * @param int|string $n The index of the results to return, or column name. - * @param string $type The type of result object. 'array', 'object' or class name. + * @param int|string $n The index of the results to return, or column name. + * @param string $type The type of result object. 'array', 'object' or class name. * @phpstan-param class-string|'array'|'object' $type * - * @return array|object|stdClass|null + * @return array|object|stdClass|null * @phpstan-return ($type is 'object' ? stdClass|null : ($type is 'array' ? array|null : object|null)) */ public function getRow($n = 0, string $type = 'object'); diff --git a/system/Database/SQLSRV/Forge.php b/system/Database/SQLSRV/Forge.php index 522d5fa02f54..5dead5b3a308 100755 --- a/system/Database/SQLSRV/Forge.php +++ b/system/Database/SQLSRV/Forge.php @@ -129,7 +129,7 @@ protected function _createTableAttributes(array $attributes): string * @param array|string $processedFields Processed column definitions * or column names to DROP * - * @return false|list|string SQL string or false + * @return false|list|string SQL string or false * @phpstan-return ($alterType is 'DROP' ? string : list|false) */ protected function _alterTable(string $alterType, string $table, $processedFields) diff --git a/system/Database/SQLite3/Forge.php b/system/Database/SQLite3/Forge.php index d7112c61389f..b02193f5057c 100644 --- a/system/Database/SQLite3/Forge.php +++ b/system/Database/SQLite3/Forge.php @@ -112,8 +112,8 @@ public function dropDatabase(string $dbName): bool * @param array|string $processedFields Processed column definitions * or column names to DROP * - * @return array|string|null - * @return list|string|null SQL string or null + * @return array|string|null + * @return list|string|null SQL string or null * @phpstan-return ($alterType is 'DROP' ? string : list|null) */ protected function _alterTable(string $alterType, string $table, $processedFields) diff --git a/system/Database/SQLite3/Table.php b/system/Database/SQLite3/Table.php index 620d28464738..ce574033afb0 100644 --- a/system/Database/SQLite3/Table.php +++ b/system/Database/SQLite3/Table.php @@ -374,7 +374,7 @@ protected function copyData() * * @param array|bool $fields * - * @return mixed + * @return mixed * @phpstan-return ($fields is array ? array : mixed) */ protected function formatFields($fields) diff --git a/system/HTTP/CLIRequest.php b/system/HTTP/CLIRequest.php index 01823dbfc4c5..684b1dbfea15 100644 --- a/system/HTTP/CLIRequest.php +++ b/system/HTTP/CLIRequest.php @@ -315,7 +315,7 @@ public function getLocale(): string /** * Checks this request type. * - * @param string $type HTTP verb or 'json' or 'ajax' + * @param string $type HTTP verb or 'json' or 'ajax' * @phpstan-param string|'get'|'post'|'put'|'delete'|'head'|'patch'|'options'|'json'|'ajax' $type */ public function is(string $type): bool diff --git a/system/HTTP/IncomingRequest.php b/system/HTTP/IncomingRequest.php index 8bc246f7956d..499fa0b1cf06 100755 --- a/system/HTTP/IncomingRequest.php +++ b/system/HTTP/IncomingRequest.php @@ -400,7 +400,7 @@ public function negotiate(string $type, array $supported, bool $strictMatch = fa /** * Checks this request type. * - * @param string $type HTTP verb or 'json' or 'ajax' + * @param string $type HTTP verb or 'json' or 'ajax' * @phpstan-param string|'get'|'post'|'put'|'delete'|'head'|'patch'|'options'|'json'|'ajax' $type */ public function is(string $type): bool diff --git a/system/HTTP/RequestTrait.php b/system/HTTP/RequestTrait.php index 6db903ddacec..9c1f4c28a52c 100644 --- a/system/HTTP/RequestTrait.php +++ b/system/HTTP/RequestTrait.php @@ -215,9 +215,9 @@ public function getEnv($index = null, $filter = null, $flags = null) /** * Allows manually setting the value of PHP global, like $_GET, $_POST, etc. * - * @param string $name Supergrlobal name (lowercase) + * @param string $name Supergrlobal name (lowercase) * @phpstan-param 'get'|'post'|'request'|'cookie'|'server' $name - * @param mixed $value + * @param mixed $value * * @return $this */ @@ -238,11 +238,11 @@ public function setGlobal(string $name, $value) * * http://php.net/manual/en/filter.filters.sanitize.php * - * @param string $name Supergrlobal name (lowercase) + * @param string $name Supergrlobal name (lowercase) * @phpstan-param 'get'|'post'|'request'|'cookie'|'server' $name - * @param array|string|null $index - * @param int|null $filter Filter constant - * @param array|int|null $flags Options + * @param array|string|null $index + * @param int|null $filter Filter constant + * @param array|int|null $flags Options * * @return array|bool|float|int|object|string|null */ @@ -332,7 +332,7 @@ public function fetchGlobal(string $name, $index = null, ?int $filter = null, $f * Saves a copy of the current state of one of several PHP globals, * so we can retrieve them later. * - * @param string $name Superglobal name (lowercase) + * @param string $name Superglobal name (lowercase) * @phpstan-param 'get'|'post'|'request'|'cookie'|'server' $name * * @return void diff --git a/system/HTTP/SiteURI.php b/system/HTTP/SiteURI.php index 6d56507314e7..b7acfc389f25 100644 --- a/system/HTTP/SiteURI.php +++ b/system/HTTP/SiteURI.php @@ -83,10 +83,10 @@ class SiteURI extends URI private string $routePath; /** - * @param string $relativePath URI path relative to baseURL. May include - * queries or fragments. - * @param string|null $host Optional current hostname. - * @param string|null $scheme Optional scheme. 'http' or 'https'. + * @param string $relativePath URI path relative to baseURL. May include + * queries or fragments. + * @param string|null $host Optional current hostname. + * @param string|null $scheme Optional scheme. 'http' or 'https'. * @phpstan-param 'http'|'https'|null $scheme */ public function __construct( diff --git a/system/Model.php b/system/Model.php index 5dba810c8c59..2596417c12e6 100644 --- a/system/Model.php +++ b/system/Model.php @@ -179,7 +179,7 @@ public function setTable(string $table) * @param bool $singleton Single or multiple results * @param array|int|string|null $id One primary key or an array of primary keys * - * @return array|object|null The resulting row of data, or null. + * @return array|object|null The resulting row of data, or null. * @phpstan-return ($singleton is true ? row_array|null|object : list) */ protected function doFind(bool $singleton, $id = null) @@ -211,7 +211,7 @@ protected function doFind(bool $singleton, $id = null) * * @param string $columnName Column Name * - * @return array|null The resulting row of data, or null if no data found. + * @return array|null The resulting row of data, or null if no data found. * @phpstan-return list|null */ protected function doFindColumn(string $columnName) @@ -227,7 +227,7 @@ protected function doFindColumn(string $columnName) * @param int $limit Limit * @param int $offset Offset * - * @return array + * @return array * @phpstan-return list */ protected function doFindAll(int $limit = 0, int $offset = 0) @@ -248,7 +248,7 @@ protected function doFindAll(int $limit = 0, int $offset = 0) * Query Builder calls into account when determining the result set. * This method works only with dbCalls. * - * @return array|object|null + * @return array|object|null * @phpstan-return row_array|object|null */ protected function doFirst() @@ -274,7 +274,7 @@ protected function doFirst() * Inserts data into the current table. * This method works only with dbCalls. * - * @param array $row Row data + * @param array $row Row data * @phpstan-param row_array $row * * @return bool @@ -364,9 +364,9 @@ protected function doInsertBatch(?array $set = null, ?bool $escape = null, int $ * Updates a single record in $this->table. * This method works only with dbCalls. * - * @param array|int|string|null $id - * @param array|null $row Row data - * @phpstan-param row_array|null $row + * @param array|int|string|null $id + * @param array|null $row Row data + * @phpstan-param row_array|null $row */ protected function doUpdate($id = null, $row = null): bool { @@ -483,9 +483,9 @@ protected function doOnlyDeleted() * Compiles a replace into string and runs the query * This method works only with dbCalls. * - * @param array|null $row Data + * @param array|null $row Data * @phpstan-param row_array|null $row - * @param bool $returnSQL Set to true to return Query String + * @param bool $returnSQL Set to true to return Query String * * @return BaseResult|false|Query|string */ @@ -531,7 +531,7 @@ protected function idValue($data) /** * Returns the id value for the data array or object * - * @param array|object $row Row data + * @param array|object $row Row data * @phpstan-param row_array|object $row * * @return array|int|string|null @@ -718,11 +718,11 @@ protected function shouldUpdate($row): bool * Inserts data into the database. If an object is provided, * it will attempt to convert it to an array. * - * @param array|object|null $row + * @param array|object|null $row * @phpstan-param row_array|object|null $row - * @param bool $returnID Whether insert ID should be returned or not. + * @param bool $returnID Whether insert ID should be returned or not. * - * @return bool|int|string + * @return bool|int|string * @phpstan-return ($returnID is true ? int|string|false : bool) * * @throws ReflectionException @@ -751,7 +751,7 @@ public function insert($row = null, bool $returnID = true) * @used-by insert() to protect against mass assignment vulnerabilities. * @used-by insertBatch() to protect against mass assignment vulnerabilities. * - * @param array $row Row data + * @param array $row Row data * @phpstan-param row_array $row * * @throws DataException @@ -784,8 +784,8 @@ protected function doProtectFieldsForInsert(array $row): array * Updates a single record in the database. If an object is provided, * it will attempt to convert it into an array. * - * @param array|int|string|null $id - * @param array|object|null $row + * @param array|int|string|null $id + * @param array|object|null $row * @phpstan-param row_array|object|null $row * * @throws ReflectionException diff --git a/system/RESTful/ResourceController.php b/system/RESTful/ResourceController.php index 6ffb602c8bd1..bd0356268142 100644 --- a/system/RESTful/ResourceController.php +++ b/system/RESTful/ResourceController.php @@ -104,7 +104,7 @@ public function delete($id = null) /** * Set/change the expected response representation for returned objects * - * @param string $format json/xml + * @param string $format json/xml * @phpstan-param 'json'|'xml' $format * * @return void diff --git a/system/Traits/ConditionalTrait.php b/system/Traits/ConditionalTrait.php index 620bdd88508b..5b8273ee78bc 100644 --- a/system/Traits/ConditionalTrait.php +++ b/system/Traits/ConditionalTrait.php @@ -18,10 +18,10 @@ trait ConditionalTrait * * @template TWhen of mixed * - * @phpstan-param TWhen $condition - * @phpstan-param callable(self, TWhen): mixed $callback - * @phpstan-param (callable(self): mixed)|null $defaultCallback - * @param array|bool|float|int|object|resource|string|null $condition + * @phpstan-param TWhen $condition + * @phpstan-param callable(self, TWhen): mixed $callback + * @phpstan-param (callable(self): mixed)|null $defaultCallback + * @param array|bool|float|int|object|resource|string|null $condition * * @return $this */ @@ -41,10 +41,10 @@ public function when($condition, callable $callback, ?callable $defaultCallback * * @template TWhenNot of mixed * - * @phpstan-param TWhenNot $condition - * @phpstan-param callable(self, TWhenNot): mixed $callback - * @phpstan-param (callable(self): mixed)|null $defaultCallback - * @param array|bool|float|int|object|resource|string|null $condition + * @phpstan-param TWhenNot $condition + * @phpstan-param callable(self, TWhenNot): mixed $callback + * @phpstan-param (callable(self): mixed)|null $defaultCallback + * @param array|bool|float|int|object|resource|string|null $condition * * @return $this */ diff --git a/system/View/Filters.php b/system/View/Filters.php index fa03a1919a2b..4b89b1265b1c 100644 --- a/system/View/Filters.php +++ b/system/View/Filters.php @@ -74,7 +74,7 @@ public static function default($value, string $default): string /** * Escapes the given value with our `esc()` helper function. * - * @param string $value + * @param string $value * @phpstan-param 'html'|'js'|'css'|'url'|'attr'|'raw' $context */ public static function esc($value, string $context = 'html'): string diff --git a/system/View/RendererInterface.php b/system/View/RendererInterface.php index a0f093b67326..4bb889743f9f 100644 --- a/system/View/RendererInterface.php +++ b/system/View/RendererInterface.php @@ -44,8 +44,8 @@ public function renderString(string $view, ?array $options = null, bool $saveDat /** * Sets several pieces of view data at once. * - * @param string $context The context to escape it for: html, css, js, url - * If 'raw', no escaping will happen + * @param string $context The context to escape it for: html, css, js, url + * If 'raw', no escaping will happen * @phpstan-param null|'html'|'js'|'css'|'url'|'attr'|'raw' $context * * @return RendererInterface @@ -55,9 +55,9 @@ public function setData(array $data = [], ?string $context = null); /** * Sets a single piece of view data. * - * @param mixed $value - * @param string $context The context to escape it for: html, css, js, url - * If 'raw' no escaping will happen + * @param mixed $value + * @param string $context The context to escape it for: html, css, js, url + * If 'raw' no escaping will happen * @phpstan-param null|'html'|'js'|'css'|'url'|'attr'|'raw' $context * * @return RendererInterface diff --git a/system/View/View.php b/system/View/View.php index 2e2823fa2332..8940951a42aa 100644 --- a/system/View/View.php +++ b/system/View/View.php @@ -330,8 +330,8 @@ public function excerpt(string $string, int $length = 20): string /** * Sets several pieces of view data at once. * - * @param string|null $context The context to escape it for: html, css, js, url - * If null, no escaping will happen + * @param string|null $context The context to escape it for: html, css, js, url + * If null, no escaping will happen * @phpstan-param null|'html'|'js'|'css'|'url'|'attr'|'raw' $context */ public function setData(array $data = [], ?string $context = null): RendererInterface @@ -349,9 +349,9 @@ public function setData(array $data = [], ?string $context = null): RendererInte /** * Sets a single piece of view data. * - * @param mixed $value - * @param string|null $context The context to escape it for: html, css, js, url - * If null, no escaping will happen + * @param mixed $value + * @param string|null $context The context to escape it for: html, css, js, url + * If null, no escaping will happen * @phpstan-param null|'html'|'js'|'css'|'url'|'attr'|'raw' $context */ public function setVar(string $name, $value = null, ?string $context = null): RendererInterface