Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

style: apply new options to phpdoc_align fixer #8462

Merged
merged 1 commit into from
Jan 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 36 additions & 36 deletions system/BaseModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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;

Expand Down Expand Up @@ -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
*/
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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<row_array|object>)
*/
public function find($id = null)
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
{
Expand All @@ -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
{
Expand All @@ -856,11 +856,11 @@ protected function setUpdatedField(array $row, $date): array
/**
* Compiles batch insert runs the queries, validating each row prior.
*
* @param list<array|object>|null $set an associative array of insert values
* @param list<array|object>|null $set an associative array of insert values
* @phpstan-param list<row_array|object>|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
*
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -999,11 +999,11 @@ public function update($id = null, $row = null): bool
/**
* Compiles an update and runs the query.
*
* @param list<array|object>|null $set an associative array of insert values
* @param list<array|object>|null $set an associative array of insert values
* @phpstan-param list<row_array|object>|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
*
Expand Down Expand Up @@ -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
*/
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
22 changes: 11 additions & 11 deletions system/Common.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -207,7 +207,7 @@ function command(string $command)
*
* @param class-string<ConfigTemplate>|string $name
*
* @return ConfigTemplate|null
* @return ConfigTemplate|null
* @phpstan-return ($name is class-string<ConfigTemplate> ? ConfigTemplate : object|null)
*/
function config(string $name, bool $getShared = true)
Expand Down Expand Up @@ -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
*
Expand Down Expand Up @@ -805,7 +805,7 @@ function log_message(string $level, string $message, array $context = [])
*
* @param class-string<ModelTemplate>|string $name
*
* @return ModelTemplate|null
* @return ModelTemplate|null
* @phpstan-return ($name is class-string<ModelTemplate> ? ModelTemplate : object|null)
*/
function model(string $name, bool $getShared = true, ?ConnectionInterface &$conn = null)
Expand All @@ -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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
18 changes: 9 additions & 9 deletions system/Database/BaseConnection.php
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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)
Expand Down Expand Up @@ -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);
Expand All @@ -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<TConnection, TResult>|bool|Query
*
* @todo BC set $queryClass default as null in 4.1
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -1665,7 +1665,7 @@ public function isWriteType($sql): bool
*
* Must return an array with keys 'code' and 'message':
*
* @return array<string, int|string|null>
* @return array<string, int|string|null>
* @phpstan-return array{code: int|string|null, message: string|null}
*/
abstract public function error(): array;
Expand Down
2 changes: 1 addition & 1 deletion system/Database/BasePreparedQuery.php
Original file line number Diff line number Diff line change
Expand Up @@ -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<TConnection, TResult>
*
* @throws DatabaseException
Expand Down
Loading
Loading