Skip to content

Commit

Permalink
Release v4.4.8
Browse files Browse the repository at this point in the history
  • Loading branch information
actions-user committed Apr 7, 2024
1 parent e6a2f70 commit 84ff359
Show file tree
Hide file tree
Showing 33 changed files with 125 additions and 121 deletions.
4 changes: 2 additions & 2 deletions app/.htaccess
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<IfModule authz_core_module>
Require all denied
Require all denied
</IfModule>
<IfModule !authz_core_module>
Deny from all
Deny from all
</IfModule>
2 changes: 1 addition & 1 deletion public/.htaccess
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,5 @@ Options -Indexes
</IfModule>

# Disable server signature start
ServerSignature Off
ServerSignature Off
# Disable server signature end
33 changes: 18 additions & 15 deletions system/BaseModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -173,11 +173,14 @@ abstract class BaseModel
protected $db;

/**
* Rules used to validate data in insert, update, and save methods.
* Rules used to validate data in insert(), update(), and save() methods.
*
* The array must match the format of data passed to the Validation
* library.
*
* @var list<string>|string
* @see https://codeigniter4.github.io/userguide/models/model.html#setting-validation-rules
*
* @var array<string, array<string, array<string, string>|string>|string>|string
*/
protected $validationRules = [];

Expand Down Expand Up @@ -243,84 +246,84 @@ abstract class BaseModel
/**
* Callbacks for beforeInsert
*
* @var array
* @var list<string>
*/
protected $beforeInsert = [];

/**
* Callbacks for afterInsert
*
* @var array
* @var list<string>
*/
protected $afterInsert = [];

/**
* Callbacks for beforeUpdate
*
* @var array
* @var list<string>
*/
protected $beforeUpdate = [];

/**
* Callbacks for afterUpdate
*
* @var array
* @var list<string>
*/
protected $afterUpdate = [];

/**
* Callbacks for beforeInsertBatch
*
* @var array
* @var list<string>
*/
protected $beforeInsertBatch = [];

/**
* Callbacks for afterInsertBatch
*
* @var array
* @var list<string>
*/
protected $afterInsertBatch = [];

/**
* Callbacks for beforeUpdateBatch
*
* @var array
* @var list<string>
*/
protected $beforeUpdateBatch = [];

/**
* Callbacks for afterUpdateBatch
*
* @var array
* @var list<string>
*/
protected $afterUpdateBatch = [];

/**
* Callbacks for beforeFind
*
* @var array
* @var list<string>
*/
protected $beforeFind = [];

/**
* Callbacks for afterFind
*
* @var array
* @var list<string>
*/
protected $afterFind = [];

/**
* Callbacks for beforeDelete
*
* @var array
* @var list<string>
*/
protected $beforeDelete = [];

/**
* Callbacks for afterDelete
*
* @var array
* @var list<string>
*/
protected $afterDelete = [];

Expand Down Expand Up @@ -1448,7 +1451,7 @@ public function setValidationMessage(string $field, array $fieldMessages)
* Allows to set (and reset) validation rules.
* It could be used when you have to change default or override current validate rules.
*
* @param array $validationRules Value
* @param array<string, array<string, array<string, string>|string>|string> $validationRules Value
*
* @return $this
*/
Expand Down
4 changes: 2 additions & 2 deletions system/CLI/CLI.php
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ public static function prompt(string $field, $options = null, $validation = null
$default = $options[0];
}

static::fwrite(STDOUT, $field . (trim($field) ? ' ' : '') . $extraOutput . ': ');
static::fwrite(STDOUT, $field . (trim($field) !== '' ? ' ' : '') . $extraOutput . ': ');

// Read the input from keyboard.
$input = trim(static::input()) ?: $default;
Expand Down Expand Up @@ -386,7 +386,7 @@ public static function promptByMultipleKeys(string $text, array $options): array
*/
private static function isZeroOptions(array $options): void
{
if (! $options) {
if ($options === []) {
throw new InvalidArgumentException('No options to select from were provided');
}
}
Expand Down
2 changes: 1 addition & 1 deletion system/CodeIgniter.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class CodeIgniter
/**
* The current version of CodeIgniter Framework
*/
public const CI_VERSION = '4.4.7';
public const CI_VERSION = '4.4.8';

/**
* App startup time.
Expand Down
2 changes: 1 addition & 1 deletion system/Commands/Database/MigrateStatus.php
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ public function run(array $params)
}
}

if (! $status) {
if ($status === []) {
// @codeCoverageIgnoreStart
CLI::error(lang('Migrations.noneFound'), 'light_gray', 'red');
CLI::newLine();
Expand Down
2 changes: 1 addition & 1 deletion system/Config/DotEnv.php
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ public function normaliseVariable(string $name, string $value = ''): array
*/
protected function sanitizeValue(string $value): string
{
if (! $value) {
if ($value === '') {
return $value;
}

Expand Down
2 changes: 1 addition & 1 deletion system/Controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ private function setValidator($rules, array $messages): void
}

// If no error message is defined, use the error message in the Config\Validation file
if (! $messages) {
if ($messages === []) {
$errorName = $rules . '_errors';
$messages = $validation->{$errorName} ?? [];
}
Expand Down
2 changes: 1 addition & 1 deletion system/Database/BaseBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ public function __construct($tableName, ConnectionInterface $db, ?array $options
/**
* Returns the current database connection
*
* @return BaseConnection|ConnectionInterface
* @return BaseConnection
*/
public function db(): ConnectionInterface
{
Expand Down
10 changes: 8 additions & 2 deletions system/Database/BaseConnection.php
Original file line number Diff line number Diff line change
Expand Up @@ -1527,7 +1527,7 @@ public function getFieldData(string $table)
/**
* Returns an object with key data
*
* @return array
* @return array<string, stdClass>
*/
public function getIndexData(string $table)
{
Expand All @@ -1547,7 +1547,9 @@ public function getForeignKeyData(string $table)
/**
* Converts array of arrays generated by _foreignKeyData() to array of objects
*
* @return array[
* @return array<string, stdClass>
*
* array[
* {constraint_name} =>
* stdClass[
* 'constraint_name' => string,
Expand Down Expand Up @@ -1704,13 +1706,17 @@ abstract protected function _fieldData(string $table): array;
* Platform-specific index data.
*
* @see getIndexData()
*
* @return array<string, stdClass>
*/
abstract protected function _indexData(string $table): array;

/**
* Platform-specific foreign keys data.
*
* @see getForeignKeyData()
*
* @return array<string, stdClass>
*/
abstract protected function _foreignKeyData(string $table): array;

Expand Down
4 changes: 2 additions & 2 deletions system/Database/BaseResult.php
Original file line number Diff line number Diff line change
Expand Up @@ -260,8 +260,8 @@ public function getResultObject(): array
* @param string $type The type of result object. 'array', 'object' or class name.
* @phpstan-param class-string<T>|'array'|'object' $type
*
* @return array|object|stdClass|null
* @phpstan-return ($type is 'object' ? stdClass|null : ($type is 'array' ? array|null : T|null))
* @return array|float|int|object|stdClass|string|null
* @phpstan-return ($n is string ? float|int|string|null : ($type is 'object' ? stdClass|null : ($type is 'array' ? array|null : T|null)))
*/
public function getRow($n = 0, string $type = 'object')
{
Expand Down
4 changes: 2 additions & 2 deletions system/Database/MySQLi/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,7 @@ protected function _fieldData(string $table): array
/**
* Returns an array of objects with index data
*
* @return list<stdClass>
* @return array<string, stdClass>
*
* @throws DatabaseException
* @throws LogicException
Expand Down Expand Up @@ -489,7 +489,7 @@ protected function _indexData(string $table): array
/**
* Returns an array of objects with Foreign key data
*
* @return list<stdClass>
* @return array<string, stdClass>
*
* @throws DatabaseException
*/
Expand Down
2 changes: 1 addition & 1 deletion system/Database/OCI8/Builder.php
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ protected function _limit(string $sql, bool $offsetIgnore = false): string
}

$this->limitUsed = true;
$limitTemplateQuery = 'SELECT * FROM (SELECT INNER_QUERY.*, ROWNUM RNUM FROM (%s) INNER_QUERY WHERE ROWNUM < %d)' . ($offset ? ' WHERE RNUM >= %d' : '');
$limitTemplateQuery = 'SELECT * FROM (SELECT INNER_QUERY.*, ROWNUM RNUM FROM (%s) INNER_QUERY WHERE ROWNUM < %d)' . ($offset !== 0 ? ' WHERE RNUM >= %d' : '');

return sprintf($limitTemplateQuery, $sql, $offset + $this->QBLimit + 1, $offset);
}
Expand Down
4 changes: 2 additions & 2 deletions system/Database/OCI8/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ protected function _fieldData(string $table): array
/**
* Returns an array of objects with index data
*
* @return list<stdClass>
* @return array<string, stdClass>
*
* @throws DatabaseException
*/
Expand Down Expand Up @@ -374,7 +374,7 @@ protected function _indexData(string $table): array
/**
* Returns an array of objects with Foreign key data
*
* @return list<stdClass>
* @return array<string, stdClass>
*
* @throws DatabaseException
*/
Expand Down
4 changes: 2 additions & 2 deletions system/Database/Postgre/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ protected function _fieldData(string $table): array
/**
* Returns an array of objects with index data
*
* @return list<stdClass>
* @return array<string, stdClass>
*
* @throws DatabaseException
*/
Expand Down Expand Up @@ -371,7 +371,7 @@ protected function _indexData(string $table): array
/**
* Returns an array of objects with Foreign key data
*
* @return list<stdClass>
* @return array<string, stdClass>
*
* @throws DatabaseException
*/
Expand Down
4 changes: 2 additions & 2 deletions system/Database/ResultInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ public function getResultObject(): array;
* @param string $type The type of result object. 'array', 'object' or class name.
* @phpstan-param class-string<T>|'array'|'object' $type
*
* @return array|object|stdClass|null
* @phpstan-return ($type is 'object' ? stdClass|null : ($type is 'array' ? array|null : T|null))
* @return array|float|int|object|stdClass|string|null
* @phpstan-return ($n is string ? float|int|string|null : ($type is 'object' ? stdClass|null : ($type is 'array' ? array|null : T|null)))
*/
public function getRow($n = 0, string $type = 'object');

Expand Down
4 changes: 2 additions & 2 deletions system/Database/SQLSRV/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ protected function _listColumns(string $table = ''): string
/**
* Returns an array of objects with index data
*
* @return list<stdClass>
* @return array<string, stdClass>
*
* @throws DatabaseException
*/
Expand Down Expand Up @@ -269,7 +269,7 @@ protected function _indexData(string $table): array
* Returns an array of objects with Foreign key data
* referenced_object_id parent_object_id
*
* @return list<stdClass>
* @return array<string, stdClass>
*
* @throws DatabaseException
*/
Expand Down
4 changes: 2 additions & 2 deletions system/Database/SQLite3/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ protected function _fieldData(string $table): array
/**
* Returns an array of objects with index data
*
* @return list<stdClass>
* @return array<string, stdClass>
*
* @throws DatabaseException
*/
Expand Down Expand Up @@ -343,7 +343,7 @@ protected function _indexData(string $table): array
/**
* Returns an array of objects with Foreign key data
*
* @return list<stdClass>
* @return array<string, stdClass>
*/
protected function _foreignKeyData(string $table): array
{
Expand Down
10 changes: 3 additions & 7 deletions system/Database/SQLite3/Table.php
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ public function addForeignKey(array $foreignKeys)
/**
* Creates the new table based on our current fields.
*
* @return mixed
* @return bool
*/
protected function createTable()
{
Expand Down Expand Up @@ -449,16 +449,12 @@ private function isNumericType(string $type): bool
* Converts keys retrieved from the database to
* the format needed to create later.
*
* @param mixed $keys
* @param array<string, stdClass> $keys
*
* @return mixed
* @return array<string, array{fields: string, type: string}>
*/
protected function formatKeys($keys)
{
if (! is_array($keys)) {
return $keys;
}

$return = [];

foreach ($keys as $name => $key) {
Expand Down
Loading

0 comments on commit 84ff359

Please sign in to comment.