Skip to content

Commit 6ffad15

Browse files
committed
Release v4.2.10
1 parent 34373df commit 6ffad15

File tree

11 files changed

+65
-92
lines changed

11 files changed

+65
-92
lines changed

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"require-dev": {
1818
"codeigniter/coding-standard": "^1.5",
1919
"fakerphp/faker": "^1.9",
20-
"friendsofphp/php-cs-fixer": "~3.12.0",
20+
"friendsofphp/php-cs-fixer": "~3.13.0",
2121
"mikey179/vfsstream": "^1.6",
2222
"nexusphp/cs-config": "^3.6",
2323
"phpunit/phpunit": "^9.1",
@@ -38,6 +38,7 @@
3838
"ext-redis": "If you use Cache class RedisHandler",
3939
"ext-dom": "If you use TestResponse",
4040
"ext-libxml": "If you use TestResponse",
41+
"ext-xdebug": "If you use CIUnitTestCase::assertHeaderEmitted()",
4142
"ext-fileinfo": "Improves mime type detection for files",
4243
"ext-readline": "Improves CLI::input() usability"
4344
},

system/CodeIgniter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ class CodeIgniter
4747
/**
4848
* The current version of CodeIgniter Framework
4949
*/
50-
public const CI_VERSION = '4.2.8';
50+
public const CI_VERSION = '4.2.10';
5151

5252
/**
5353
* App startup time.

system/Config/Factories.php

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,15 @@ class Factories
3131
* Store of component-specific options, usually
3232
* from CodeIgniter\Config\Factory.
3333
*
34-
* @var array<string, array>
34+
* @var array<string, array<string, bool|string|null>>
3535
*/
3636
protected static $options = [];
3737

3838
/**
3939
* Explicit options for the Config
4040
* component to prevent logic loops.
4141
*
42-
* @var array<string, mixed>
42+
* @var array<string, bool|string|null>
4343
*/
4444
private static array $configOptions = [
4545
'component' => 'config',
@@ -53,7 +53,8 @@ class Factories
5353
* Mapping of class basenames (no namespace) to
5454
* their instances.
5555
*
56-
* @var array<string, string[]>
56+
* @var array<string, array<string, string>>
57+
* @phpstan-var array<string, array<string, class-string>>
5758
*/
5859
protected static $basenames = [];
5960

@@ -63,7 +64,8 @@ class Factories
6364
* A multi-dimensional array with components as
6465
* keys to the array of name-indexed instances.
6566
*
66-
* @var array<string, array>
67+
* @var array<string, array<string, object>>
68+
* @phpstan-var array<string, array<class-string, object>>
6769
*/
6870
protected static $instances = [];
6971

@@ -74,9 +76,10 @@ class Factories
7476
*
7577
* @template T of Model
7678
*
77-
* @param class-string<T> $name
79+
* @phpstan-param class-string<T> $name
7880
*
79-
* @return T
81+
* @return Model
82+
* @phpstan-return T
8083
*/
8184
public static function models(string $name, array $options = [], ?ConnectionInterface &$conn = null)
8285
{
@@ -228,7 +231,7 @@ protected static function verifyInstanceOf(array $options, string $name): bool
228231
*
229232
* @param string $component Lowercase, plural component name
230233
*
231-
* @return array<string, mixed>
234+
* @return array<string, bool|string|null>
232235
*/
233236
public static function getOptions(string $component): array
234237
{
@@ -253,7 +256,7 @@ public static function getOptions(string $component): array
253256
*
254257
* @param string $component Lowercase, plural component name
255258
*
256-
* @return array<string, mixed> The result after applying defaults and normalization
259+
* @return array<string, bool|string|null> The result after applying defaults and normalization
257260
*/
258261
public static function setOptions(string $component, array $values): array
259262
{

system/Database/SQLSRV/Connection.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ public function connect(bool $persistent = false)
141141
$errors = [];
142142

143143
foreach (sqlsrv_errors(SQLSRV_ERR_ERRORS) as $error) {
144-
$errors[] = preg_replace('/(\[.+\]\[.+\](?:\[.+\])?)(.+)/', '$2', $error['message']);
144+
$errors[] = (string) preg_replace('/(\[.+\]\[.+\](?:\[.+\])?)(.+)/', '$2', $error['message']);
145145
}
146146

147147
throw new DatabaseException(implode("\n", $errors));

system/Debug/Toolbar.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -405,6 +405,7 @@ public function prepare(?RequestInterface $request = null, ?ResponseInterface $r
405405
$kintScript = @Kint::dump('');
406406
Kint::$mode_default = $oldKintMode;
407407
$kintScript = substr($kintScript, 0, strpos($kintScript, '</style>') + 8);
408+
$kintScript = ($kintScript === '0') ? '' : $kintScript;
408409

409410
$script = PHP_EOL
410411
. '<script type="text/javascript" ' . csp_script_nonce() . ' id="debugbar_loader" '

system/HTTP/CURLRequest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -474,7 +474,7 @@ protected function setResponseHeaders(array $headers = [])
474474
}
475475

476476
if (isset($matches[2])) {
477-
$this->response->setStatusCode($matches[2], $matches[3] ?? null);
477+
$this->response->setStatusCode((int) $matches[2], $matches[3] ?? null);
478478
}
479479
}
480480
}

system/Helpers/text_helper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -598,7 +598,7 @@ function increment_string(string $str, string $separator = '_', int $first = 1):
598598
{
599599
preg_match('/(.+)' . preg_quote($separator, '/') . '([0-9]+)$/', $str, $match);
600600

601-
return isset($match[2]) ? $match[1] . $separator . ($match[2] + 1) : $str . $separator . $first;
601+
return isset($match[2]) ? $match[1] . $separator . ((int) $match[2] + 1) : $str . $separator . $first;
602602
}
603603
}
604604

system/Model.php

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -157,8 +157,8 @@ public function setTable(string $table)
157157

158158
/**
159159
* Fetches the row of database from $this->table with a primary key
160-
* matching $id. This methods works only with dbCalls
161-
* This methods works only with dbCalls
160+
* matching $id.
161+
* This method works only with dbCalls.
162162
*
163163
* @param bool $singleton Single or multiple results
164164
* @param array|int|string|null $id One primary key or an array of primary keys
@@ -189,8 +189,8 @@ protected function doFind(bool $singleton, $id = null)
189189
}
190190

191191
/**
192-
* Fetches the column of database from $this->table
193-
* This methods works only with dbCalls
192+
* Fetches the column of database from $this->table.
193+
* This method works only with dbCalls.
194194
*
195195
* @param string $columnName Column Name
196196
*
@@ -204,7 +204,7 @@ protected function doFindColumn(string $columnName)
204204
/**
205205
* Works with the current Query Builder instance to return
206206
* all results, while optionally limiting them.
207-
* This methods works only with dbCalls
207+
* This method works only with dbCalls.
208208
*
209209
* @param int $limit Limit
210210
* @param int $offset Offset
@@ -227,7 +227,7 @@ protected function doFindAll(int $limit = 0, int $offset = 0)
227227
/**
228228
* Returns the first row of the result set. Will take any previous
229229
* Query Builder calls into account when determining the result set.
230-
* This methods works only with dbCalls
230+
* This method works only with dbCalls.
231231
*
232232
* @return array|object|null
233233
*/
@@ -252,7 +252,7 @@ protected function doFirst()
252252

253253
/**
254254
* Inserts data into the current table.
255-
* This method works only with dbCalls
255+
* This method works only with dbCalls.
256256
*
257257
* @param array $data Data
258258
*
@@ -288,7 +288,7 @@ protected function doInsert(array $data)
288288

289289
/**
290290
* Compiles batch insert strings and runs the queries, validating each row prior.
291-
* This methods works only with dbCalls
291+
* This method works only with dbCalls.
292292
*
293293
* @param array|null $set An associative array of insert values
294294
* @param bool|null $escape Whether to escape values
@@ -314,7 +314,7 @@ protected function doInsertBatch(?array $set = null, ?bool $escape = null, int $
314314

315315
/**
316316
* Updates a single record in $this->table.
317-
* This methods works only with dbCalls
317+
* This method works only with dbCalls.
318318
*
319319
* @param array|int|string|null $id
320320
* @param array|null $data
@@ -340,7 +340,7 @@ protected function doUpdate($id = null, $data = null): bool
340340

341341
/**
342342
* Compiles an update string and runs the query
343-
* This methods works only with dbCalls
343+
* This method works only with dbCalls.
344344
*
345345
* @param array|null $set An associative array of update values
346346
* @param string|null $index The where key
@@ -359,7 +359,7 @@ protected function doUpdateBatch(?array $set = null, ?string $index = null, int
359359
/**
360360
* Deletes a single record from $this->table where $id matches
361361
* the table's primaryKey
362-
* This methods works only with dbCalls
362+
* This method works only with dbCalls.
363363
*
364364
* @param array|int|string|null $id The rows primary key(s)
365365
* @param bool $purge Allows overriding the soft deletes setting.
@@ -404,7 +404,7 @@ protected function doDelete($id = null, bool $purge = false)
404404
/**
405405
* Permanently deletes all rows that have been marked as deleted
406406
* through soft deletes (deleted = 1)
407-
* This methods works only with dbCalls
407+
* This method works only with dbCalls.
408408
*
409409
* @return bool|string Returns a string if in test mode.
410410
*/
@@ -418,7 +418,7 @@ protected function doPurgeDeleted()
418418
/**
419419
* Works with the find* methods to return only the rows that
420420
* have been deleted.
421-
* This methods works only with dbCalls
421+
* This method works only with dbCalls.
422422
*/
423423
protected function doOnlyDeleted()
424424
{
@@ -427,7 +427,7 @@ protected function doOnlyDeleted()
427427

428428
/**
429429
* Compiles a replace into string and runs the query
430-
* This methods works only with dbCalls
430+
* This method works only with dbCalls.
431431
*
432432
* @param array|null $data Data
433433
* @param bool $returnSQL Set to true to return Query String
@@ -443,7 +443,7 @@ protected function doReplace(?array $data = null, bool $returnSQL = false)
443443
* Grabs the last error(s) that occurred from the Database connection.
444444
* The return array should be in the following format:
445445
* ['source' => 'message']
446-
* This methods works only with dbCalls
446+
* This method works only with dbCalls.
447447
*
448448
* @return array<string,string>
449449
*/
@@ -497,7 +497,7 @@ public function getIdValue($data)
497497
* Loops over records in batches, allowing you to operate on them.
498498
* Works with $this->builder to get the Compiled select to
499499
* determine the rows to operate on.
500-
* This methods works only with dbCalls
500+
* This method works only with dbCalls.
501501
*
502502
* @throws DataException
503503
*/

system/Session/Handlers/MemcachedHandler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ public function open($path, $name): bool
103103
continue;
104104
}
105105

106-
if (! $this->memcached->addServer($match[1], $match[2], $match[3] ?? 0)) {
106+
if (! $this->memcached->addServer($match[1], (int) $match[2], $match[3] ?? 0)) {
107107
$this->logger->error('Could not add ' . $match[1] . ':' . $match[2] . ' to Memcached server pool.');
108108
} else {
109109
$serverList[] = $match[1] . ':' . $match[2];

system/Session/Session.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ public function __construct(SessionHandlerInterface $driver, App $config)
197197
/**
198198
* Initialize the session container and starts up the session.
199199
*
200-
* @return mixed
200+
* @return $this|void
201201
*/
202202
public function start()
203203
{
@@ -450,8 +450,8 @@ public function destroy()
450450
* If $data is an array, it is expected to be an array of key/value pairs
451451
* to be set as session properties.
452452
*
453-
* @param array|string $data Property name or associative array of properties
454-
* @param mixed $value Property value if single key provided
453+
* @param array|string $data Property name or associative array of properties
454+
* @param array|bool|float|int|object|string|null $value Property value if single key provided
455455
*/
456456
public function set($data, $value = null)
457457
{
@@ -612,8 +612,8 @@ public function __isset(string $key): bool
612612
* Otherwise, it is interpreted as the identifier of a specific
613613
* flashdata property, with $value containing the property value.
614614
*
615-
* @param array|string $data Property identifier or associative array of properties
616-
* @param array|string $value Property value if $data is a scalar
615+
* @param array|string $data Property identifier or associative array of properties
616+
* @param array|bool|float|int|object|string|null $value Property value if $data is a scalar
617617
*/
618618
public function setFlashdata($data, $value = null)
619619
{
@@ -695,7 +695,7 @@ public function markAsFlashdata($key): bool
695695
/**
696696
* Unmark data in the session as flashdata.
697697
*
698-
* @param mixed $key Property identifier or array of them
698+
* @param array|string $key Property identifier or array of them
699699
*/
700700
public function unmarkFlashdata($key)
701701
{
@@ -744,9 +744,9 @@ public function getFlashKeys(): array
744744
* Sets new data into the session, and marks it as temporary data
745745
* with a set lifespan.
746746
*
747-
* @param array|string $data Session data key or associative array of items
748-
* @param null $value Value to store
749-
* @param int $ttl Time-to-live in seconds
747+
* @param array|string $data Session data key or associative array of items
748+
* @param array|bool|float|int|object|string|null $value Value to store
749+
* @param int $ttl Time-to-live in seconds
750750
*/
751751
public function setTempdata($data, $value = null, int $ttl = 300)
752752
{
@@ -760,7 +760,7 @@ public function setTempdata($data, $value = null, int $ttl = 300)
760760
*
761761
* @param string $key Session data key
762762
*
763-
* @return mixed Session data value or null if not found.
763+
* @return array|bool|float|int|object|string|null Session data value or null if not found.
764764
*/
765765
public function getTempdata(?string $key = null)
766766
{

0 commit comments

Comments
 (0)