mirror of
https://github.com/codeigniter4/CodeIgniter4.git
synced 2025-02-20 11:44:28 +08:00
Merge remote-tracking branch 'upstream/develop' into 4.5
Conflicts: system/HTTP/CLIRequest.php system/HTTP/IncomingRequest.php system/Model.php user_guide_src/source/changelogs/index.rst user_guide_src/source/installation/upgrading.rst
This commit is contained in:
commit
fff4508121
@ -215,7 +215,7 @@ class Autoloader
|
||||
*
|
||||
* If a prefix param is set, returns only paths to the given prefix.
|
||||
*
|
||||
* @return array<string, list<string>>|list<string>
|
||||
* @return array<string, list<string>>|list<string>
|
||||
* @phpstan-return ($prefix is null ? array<string, list<string>> : list<string>)
|
||||
*/
|
||||
public function getNamespace(?string $prefix = null)
|
||||
|
@ -399,7 +399,7 @@ abstract class BaseModel
|
||||
* 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
|
||||
@ -423,9 +423,9 @@ abstract class BaseModel
|
||||
* 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;
|
||||
|
||||
@ -479,9 +479,9 @@ abstract class BaseModel
|
||||
* 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
|
||||
*/
|
||||
@ -499,7 +499,7 @@ abstract class BaseModel
|
||||
* 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
|
||||
@ -535,7 +535,7 @@ abstract class BaseModel
|
||||
*
|
||||
* @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)
|
||||
@ -683,7 +683,7 @@ abstract class BaseModel
|
||||
* 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
|
||||
@ -711,7 +711,7 @@ abstract class BaseModel
|
||||
* 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
|
||||
@ -735,11 +735,11 @@ abstract class BaseModel
|
||||
* 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
|
||||
@ -813,8 +813,8 @@ abstract class BaseModel
|
||||
/**
|
||||
* 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
|
||||
{
|
||||
@ -828,8 +828,8 @@ abstract class BaseModel
|
||||
/**
|
||||
* 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
|
||||
{
|
||||
@ -843,11 +843,11 @@ abstract class BaseModel
|
||||
/**
|
||||
* 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
|
||||
*
|
||||
@ -924,8 +924,8 @@ abstract class BaseModel
|
||||
* 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
|
||||
@ -986,11 +986,11 @@ abstract class BaseModel
|
||||
/**
|
||||
* 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
|
||||
*
|
||||
@ -1160,9 +1160,9 @@ abstract class BaseModel
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
@ -1270,7 +1270,7 @@ abstract class BaseModel
|
||||
* @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
|
||||
@ -1301,7 +1301,7 @@ abstract class BaseModel
|
||||
* @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
|
||||
@ -1498,7 +1498,7 @@ abstract class BaseModel
|
||||
* 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
|
||||
@ -1587,8 +1587,8 @@ abstract class BaseModel
|
||||
* 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
|
||||
@ -1772,9 +1772,9 @@ abstract class BaseModel
|
||||
/**
|
||||
* 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
|
||||
|
@ -361,7 +361,7 @@ class LocalizationFinder extends BaseCommand
|
||||
/**
|
||||
* @param SplFileInfo[] $files
|
||||
*
|
||||
* @return array<string, array|int>
|
||||
* @return array<string, array|int>
|
||||
* @phpstan-return array{'foundLanguageKeys': array<string, array<string, string>>, 'badLanguageKeys': array<int, array<int, string>>, 'countFiles': int}
|
||||
*/
|
||||
private function findLanguageKeysInFiles(array $files): array
|
||||
|
@ -66,7 +66,7 @@ if (! function_exists('cache')) {
|
||||
* 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)
|
||||
@ -209,7 +209,7 @@ if (! function_exists('config')) {
|
||||
*
|
||||
* @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)
|
||||
@ -416,11 +416,11 @@ if (! function_exists('esc')) {
|
||||
* 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
|
||||
*
|
||||
@ -809,7 +809,7 @@ if (! function_exists('model')) {
|
||||
*
|
||||
* @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)
|
||||
@ -823,8 +823,8 @@ if (! function_exists('old')) {
|
||||
* 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
|
||||
@ -978,7 +978,7 @@ if (! function_exists('session')) {
|
||||
* 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)
|
||||
@ -1132,7 +1132,7 @@ if (! function_exists('timer')) {
|
||||
* @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)
|
||||
|
@ -464,7 +464,7 @@ abstract class BaseConnection implements ConnectionInterface
|
||||
/**
|
||||
* Create a persistent database connection.
|
||||
*
|
||||
* @return false|object|resource
|
||||
* @return false|object|resource
|
||||
* @phpstan-return false|TConnection
|
||||
*/
|
||||
public function persistentConnect()
|
||||
@ -478,7 +478,7 @@ abstract class BaseConnection implements ConnectionInterface
|
||||
* 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)
|
||||
@ -554,7 +554,7 @@ abstract class BaseConnection implements ConnectionInterface
|
||||
/**
|
||||
* Executes the query against the database.
|
||||
*
|
||||
* @return false|object|resource
|
||||
* @return false|object|resource
|
||||
* @phpstan-return false|TResult
|
||||
*/
|
||||
abstract protected function execute(string $sql);
|
||||
@ -569,7 +569,7 @@ abstract class BaseConnection implements ConnectionInterface
|
||||
*
|
||||
* @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
|
||||
@ -688,7 +688,7 @@ abstract class BaseConnection implements ConnectionInterface
|
||||
* 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)
|
||||
@ -1013,7 +1013,7 @@ abstract class BaseConnection implements ConnectionInterface
|
||||
* @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)
|
||||
@ -1176,7 +1176,7 @@ abstract class BaseConnection implements ConnectionInterface
|
||||
*
|
||||
* @param array|string $item
|
||||
*
|
||||
* @return array|string
|
||||
* @return array|string
|
||||
* @phpstan-return ($item is array ? array : string)
|
||||
*/
|
||||
public function escapeIdentifiers($item)
|
||||
@ -1261,7 +1261,7 @@ abstract class BaseConnection implements ConnectionInterface
|
||||
*
|
||||
* @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)
|
||||
@ -1675,7 +1675,7 @@ abstract class BaseConnection implements ConnectionInterface
|
||||
*
|
||||
* 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;
|
||||
|
@ -112,7 +112,7 @@ abstract class BasePreparedQuery implements 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<TConnection, TResult>
|
||||
*
|
||||
* @throws DatabaseException
|
||||
|
@ -85,10 +85,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)
|
||||
{
|
||||
@ -211,7 +211,7 @@ abstract class BaseResult implements ResultInterface
|
||||
*
|
||||
* If no results, an empty array is returned.
|
||||
*
|
||||
* @return array<int, stdClass>
|
||||
* @return array<int, stdClass>
|
||||
* @phpstan-return list<stdClass>
|
||||
*/
|
||||
public function getResultObject(): array
|
||||
@ -256,11 +256,11 @@ abstract class BaseResult implements ResultInterface
|
||||
*
|
||||
* 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')
|
||||
|
@ -29,7 +29,7 @@ interface ConnectionInterface
|
||||
/**
|
||||
* Connect to the database.
|
||||
*
|
||||
* @return false|object|resource
|
||||
* @return false|object|resource
|
||||
* @phpstan-return false|TConnection
|
||||
*/
|
||||
public function connect(bool $persistent = false);
|
||||
@ -37,7 +37,7 @@ interface ConnectionInterface
|
||||
/**
|
||||
* Create a persistent database connection.
|
||||
*
|
||||
* @return false|object|resource
|
||||
* @return false|object|resource
|
||||
* @phpstan-return false|TConnection
|
||||
*/
|
||||
public function persistentConnect();
|
||||
@ -56,7 +56,7 @@ interface ConnectionInterface
|
||||
* 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);
|
||||
@ -102,7 +102,7 @@ interface ConnectionInterface
|
||||
*
|
||||
* @param array|string|null $binds
|
||||
*
|
||||
* @return BaseResult|bool|Query
|
||||
* @return BaseResult|bool|Query
|
||||
* @phpstan-return BaseResult<TConnection, TResult>|bool|Query
|
||||
*/
|
||||
public function query(string $sql, $binds = null);
|
||||
@ -112,7 +112,7 @@ interface ConnectionInterface
|
||||
* 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);
|
||||
@ -141,7 +141,7 @@ interface ConnectionInterface
|
||||
*
|
||||
* @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);
|
||||
|
@ -833,7 +833,7 @@ class Forge
|
||||
* @param array|string $processedFields Processed column definitions
|
||||
* or column names to DROP
|
||||
*
|
||||
* @return false|list<string>|string|null SQL string
|
||||
* @return false|list<string>|string|null SQL string
|
||||
* @phpstan-return ($alterType is 'DROP' ? string : list<string>|false|null)
|
||||
*/
|
||||
protected function _alterTable(string $alterType, string $table, $processedFields)
|
||||
|
@ -135,7 +135,7 @@ class Forge extends BaseForge
|
||||
* @param array|string $processedFields Processed column definitions
|
||||
* or column names to DROP
|
||||
*
|
||||
* @return list<string>|string SQL string
|
||||
* @return list<string>|string SQL string
|
||||
* @phpstan-return ($alterType is 'DROP' ? string : list<string>)
|
||||
*/
|
||||
protected function _alterTable(string $alterType, string $table, $processedFields)
|
||||
|
@ -100,7 +100,7 @@ class Forge extends BaseForge
|
||||
* @param array|string $processedFields Processed column definitions
|
||||
* or column names to DROP
|
||||
*
|
||||
* @return list<string>|string SQL string
|
||||
* @return list<string>|string SQL string
|
||||
* @phpstan-return ($alterType is 'DROP' ? string : list<string>)
|
||||
*/
|
||||
protected function _alterTable(string $alterType, string $table, $processedFields)
|
||||
|
@ -57,7 +57,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)
|
||||
@ -180,7 +180,7 @@ class Connection extends BaseConnection
|
||||
/**
|
||||
* Executes the query against the database.
|
||||
*
|
||||
* @return false|resource
|
||||
* @return false|resource
|
||||
* @phpstan-return false|PgSqlResult
|
||||
*/
|
||||
protected function execute(string $sql)
|
||||
@ -221,7 +221,7 @@ class Connection extends BaseConnection
|
||||
*
|
||||
* @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)
|
||||
|
@ -86,7 +86,7 @@ class Forge extends BaseForge
|
||||
* @param array|string $processedFields Processed column definitions
|
||||
* or column names to DROP
|
||||
*
|
||||
* @return false|list<string>|string SQL string or false
|
||||
* @return false|list<string>|string SQL string or false
|
||||
* @phpstan-return ($alterType is 'DROP' ? string : list<string>|false)
|
||||
*/
|
||||
protected function _alterTable(string $alterType, string $table, $processedFields)
|
||||
|
@ -95,7 +95,7 @@ class PreparedQuery extends BasePreparedQuery
|
||||
/**
|
||||
* 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()
|
||||
|
@ -26,7 +26,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<TConnection, TResult>
|
||||
*/
|
||||
public function execute(...$data);
|
||||
|
@ -59,11 +59,11 @@ interface ResultInterface
|
||||
*
|
||||
* 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');
|
||||
|
@ -131,7 +131,7 @@ class Forge extends BaseForge
|
||||
* @param array|string $processedFields Processed column definitions
|
||||
* or column names to DROP
|
||||
*
|
||||
* @return false|list<string>|string SQL string or false
|
||||
* @return false|list<string>|string SQL string or false
|
||||
* @phpstan-return ($alterType is 'DROP' ? string : list<string>|false)
|
||||
*/
|
||||
protected function _alterTable(string $alterType, string $table, $processedFields)
|
||||
|
@ -114,8 +114,8 @@ class Forge extends BaseForge
|
||||
* @param array|string $processedFields Processed column definitions
|
||||
* or column names to DROP
|
||||
*
|
||||
* @return array|string|null
|
||||
* @return list<string>|string|null SQL string or null
|
||||
* @return array|string|null
|
||||
* @return list<string>|string|null SQL string or null
|
||||
* @phpstan-return ($alterType is 'DROP' ? string : list<string>|null)
|
||||
*/
|
||||
protected function _alterTable(string $alterType, string $table, $processedFields)
|
||||
|
@ -376,7 +376,7 @@ class Table
|
||||
*
|
||||
* @param array|bool $fields
|
||||
*
|
||||
* @return mixed
|
||||
* @return mixed
|
||||
* @phpstan-return ($fields is array ? array : mixed)
|
||||
*/
|
||||
protected function formatFields($fields)
|
||||
|
@ -166,7 +166,7 @@ class Filters
|
||||
* Runs through all of the filters for the specified
|
||||
* uri and position.
|
||||
*
|
||||
* @param string $uri URI path relative to baseURL
|
||||
* @param string $uri URI path relative to baseURL
|
||||
* @phpstan-param 'before'|'after' $position
|
||||
*
|
||||
* @return RequestInterface|ResponseInterface|string|null
|
||||
|
@ -317,7 +317,8 @@ class CLIRequest extends Request
|
||||
/**
|
||||
* 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
|
||||
{
|
||||
|
@ -398,8 +398,8 @@ class IncomingRequest extends Request
|
||||
/**
|
||||
* Checks this request type.
|
||||
*
|
||||
* @param string $type HTTP verb or 'json' or 'ajax'.
|
||||
* HTTP verb should be case-sensitive, but this is case-insensitive.
|
||||
* @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
|
||||
{
|
||||
|
@ -217,9 +217,9 @@ trait RequestTrait
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
@ -240,11 +240,11 @@ trait RequestTrait
|
||||
*
|
||||
* 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
|
||||
*/
|
||||
@ -334,7 +334,7 @@ trait RequestTrait
|
||||
* 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
|
||||
|
@ -85,10 +85,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(
|
||||
|
@ -179,7 +179,7 @@ class Model extends BaseModel
|
||||
* @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<row_array|object>)
|
||||
*/
|
||||
protected function doFind(bool $singleton, $id = null)
|
||||
@ -211,7 +211,7 @@ class Model extends BaseModel
|
||||
*
|
||||
* @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<row_array>|null
|
||||
*/
|
||||
protected function doFindColumn(string $columnName)
|
||||
@ -227,7 +227,7 @@ class Model extends BaseModel
|
||||
* @param int|null $limit Limit
|
||||
* @param int $offset Offset
|
||||
*
|
||||
* @return array
|
||||
* @return array
|
||||
* @phpstan-return list<row_array|object>
|
||||
*/
|
||||
protected function doFindAll(?int $limit = null, int $offset = 0)
|
||||
@ -252,7 +252,7 @@ class Model extends BaseModel
|
||||
* 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()
|
||||
@ -278,7 +278,7 @@ class Model extends BaseModel
|
||||
* 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
|
||||
@ -368,9 +368,9 @@ class Model extends BaseModel
|
||||
* 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
|
||||
{
|
||||
@ -487,9 +487,9 @@ class Model extends BaseModel
|
||||
* 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
|
||||
*/
|
||||
@ -521,7 +521,7 @@ class Model extends BaseModel
|
||||
/**
|
||||
* 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
|
||||
@ -708,11 +708,11 @@ class Model extends BaseModel
|
||||
* 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
|
||||
@ -741,7 +741,7 @@ class Model extends BaseModel
|
||||
* @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
|
||||
@ -774,8 +774,8 @@ class Model extends BaseModel
|
||||
* 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
|
||||
|
@ -106,7 +106,7 @@ class ResourceController extends BaseResource
|
||||
/**
|
||||
* 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
|
||||
|
@ -39,8 +39,8 @@ final class MockInputOutput extends InputOutput
|
||||
/**
|
||||
* Sets user inputs.
|
||||
*
|
||||
* @param array<int, string> $inputs
|
||||
* @phpstan-param list<string> $inputs
|
||||
* @param array<int, string> $inputs
|
||||
* @phpstan-param list<string> $inputs
|
||||
*/
|
||||
public function setInputs(array $inputs): void
|
||||
{
|
||||
|
@ -20,10 +20,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
|
||||
*/
|
||||
@ -43,10 +43,10 @@ trait ConditionalTrait
|
||||
*
|
||||
* @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
|
||||
*/
|
||||
|
@ -80,7 +80,7 @@ class Filters
|
||||
/**
|
||||
* 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
|
||||
|
@ -46,8 +46,8 @@ interface RendererInterface
|
||||
/**
|
||||
* 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
|
||||
@ -57,9 +57,9 @@ interface RendererInterface
|
||||
/**
|
||||
* 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
|
||||
|
@ -337,8 +337,8 @@ class View implements RendererInterface
|
||||
/**
|
||||
* 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
|
||||
@ -356,9 +356,9 @@ class View implements RendererInterface
|
||||
/**
|
||||
* 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
|
||||
|
@ -32,6 +32,8 @@ use Imagick;
|
||||
* @internal
|
||||
*
|
||||
* @group Others
|
||||
*
|
||||
* @requires extension imagick
|
||||
*/
|
||||
final class ImageMagickHandlerTest extends CIUnitTestCase
|
||||
{
|
||||
@ -42,10 +44,6 @@ final class ImageMagickHandlerTest extends CIUnitTestCase
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
if (! extension_loaded('imagick')) {
|
||||
$this->markTestSkipped('The ImageMagick extension is not available.');
|
||||
}
|
||||
|
||||
$this->root = WRITEPATH . 'cache/';
|
||||
|
||||
// cleanup everything
|
||||
@ -57,11 +55,28 @@ final class ImageMagickHandlerTest extends CIUnitTestCase
|
||||
|
||||
$this->path = $this->origin . 'ci-logo.png';
|
||||
|
||||
$handlerConfig = new Images();
|
||||
if (is_file('/usr/bin/convert')) {
|
||||
$handlerConfig->libraryPath = '/usr/bin/convert';
|
||||
// get our locally available `convert`
|
||||
$config = new Images();
|
||||
$found = false;
|
||||
|
||||
foreach ([
|
||||
'/usr/bin/convert',
|
||||
trim((string) shell_exec('which convert')),
|
||||
$config->libraryPath,
|
||||
] as $convert) {
|
||||
if (is_file($convert)) {
|
||||
$config->libraryPath = $convert;
|
||||
|
||||
$found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
$this->handler = Services::image('imagick', $handlerConfig, false);
|
||||
|
||||
if (! $found) {
|
||||
$this->markTestSkipped('Cannot test imagick as there is no available convert program.');
|
||||
}
|
||||
|
||||
$this->handler = Services::image('imagick', $config, false);
|
||||
}
|
||||
|
||||
public function testGetVersion(): void
|
||||
|
@ -13,6 +13,7 @@ See all the changes.
|
||||
:titlesonly:
|
||||
|
||||
v4.5.0
|
||||
v4.4.6
|
||||
v4.4.5
|
||||
v4.4.4
|
||||
v4.4.3
|
||||
|
35
user_guide_src/source/changelogs/v4.4.6.rst
Normal file
35
user_guide_src/source/changelogs/v4.4.6.rst
Normal file
@ -0,0 +1,35 @@
|
||||
#############
|
||||
Version 4.4.6
|
||||
#############
|
||||
|
||||
Release Date: Unreleased
|
||||
|
||||
**4.4.6 release of CodeIgniter4**
|
||||
|
||||
.. contents::
|
||||
:local:
|
||||
:depth: 3
|
||||
|
||||
********
|
||||
BREAKING
|
||||
********
|
||||
|
||||
***************
|
||||
Message Changes
|
||||
***************
|
||||
|
||||
*******
|
||||
Changes
|
||||
*******
|
||||
|
||||
************
|
||||
Deprecations
|
||||
************
|
||||
|
||||
**********
|
||||
Bugs Fixed
|
||||
**********
|
||||
|
||||
See the repo's
|
||||
`CHANGELOG.md <https://github.com/codeigniter4/CodeIgniter4/blob/develop/CHANGELOG.md>`_
|
||||
for a complete list of bugs fixed.
|
54
user_guide_src/source/installation/upgrade_446.rst
Normal file
54
user_guide_src/source/installation/upgrade_446.rst
Normal file
@ -0,0 +1,54 @@
|
||||
#############################
|
||||
Upgrading from 4.4.5 to 4.4.6
|
||||
#############################
|
||||
|
||||
Please refer to the upgrade instructions corresponding to your installation method.
|
||||
|
||||
- :ref:`Composer Installation App Starter Upgrading <app-starter-upgrading>`
|
||||
- :ref:`Composer Installation Adding CodeIgniter4 to an Existing Project Upgrading <adding-codeigniter4-upgrading>`
|
||||
- :ref:`Manual Installation Upgrading <installing-manual-upgrading>`
|
||||
|
||||
.. contents::
|
||||
:local:
|
||||
:depth: 2
|
||||
|
||||
**********************
|
||||
Mandatory File Changes
|
||||
**********************
|
||||
|
||||
****************
|
||||
Breaking Changes
|
||||
****************
|
||||
|
||||
*********************
|
||||
Breaking Enhancements
|
||||
*********************
|
||||
|
||||
*************
|
||||
Project Files
|
||||
*************
|
||||
|
||||
Some files in the **project space** (root, app, public, writable) received updates. Due to
|
||||
these files being outside of the **system** scope they will not be changed without your intervention.
|
||||
|
||||
There are some third-party CodeIgniter modules available to assist with merging changes to
|
||||
the project space: `Explore on Packagist <https://packagist.org/explore/?query=codeigniter4%20updates>`_.
|
||||
|
||||
Content Changes
|
||||
===============
|
||||
|
||||
The following files received significant changes (including deprecations or visual adjustments)
|
||||
and it is recommended that you merge the updated versions with your application:
|
||||
|
||||
Config
|
||||
------
|
||||
|
||||
- @TODO
|
||||
|
||||
All Changes
|
||||
===========
|
||||
|
||||
This is a list of all files in the **project space** that received changes;
|
||||
many will be simple comments or formatting that have no effect on the runtime:
|
||||
|
||||
- @TODO
|
@ -17,6 +17,7 @@ See also :doc:`./backward_compatibility_notes`.
|
||||
backward_compatibility_notes
|
||||
|
||||
upgrade_450
|
||||
upgrade_446
|
||||
upgrade_445
|
||||
upgrade_444
|
||||
upgrade_443
|
||||
|
Loading…
x
Reference in New Issue
Block a user