Skip to content

Commit daf65f9

Browse files
authored
Merge pull request #9358 from codeigniter4/develop
4.5.7 Ready code
2 parents 51cdd7d + e8cd894 commit daf65f9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+315
-180
lines changed

.github/ISSUE_TEMPLATE/config.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ blank_issues_enabled: false
22
contact_links:
33
- name: CodeIgniter Forum
44
url: https://forum.codeigniter.com/forum-30.html
5-
about: Please ask your support questions in the forums. Thanks!
5+
about: Please ask your support questions and/or feature requests in the forums. Thanks!
66

77
- name: CodeIgniter Slack channel
88
url: https://codeigniterchat.slack.com

.github/ISSUE_TEMPLATE/feature_request.md

-11
This file was deleted.
+2-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
---
22
name: Planned work
3-
about: Approved work planning
3+
about: Maintainers' space. DO NOT use this for your bug reports!
44
title: 'Dev: '
55
labels: dev
66
assignees: ''
77

88
---
99

10-
Repo maintainers will create "issues" for planned work, so it can be tracked.
10+
Maintainers will create "issues" for planned work, so it can be tracked.

.github/mergeable.yml

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# https://mergeable.readthedocs.io/en/latest/configuration.html
2+
3+
version: 2
4+
mergeable:
5+
- when: issues.opened
6+
validate:
7+
- do: description
8+
and:
9+
- must_include:
10+
regex: '^### PHP Version'
11+
- must_include:
12+
regex: '^### CodeIgniter4 Version'
13+
- do: author
14+
and:
15+
- must_exclude:
16+
regex: 'kenjis'
17+
- must_exclude:
18+
regex: 'lonnieezell'
19+
- must_exclude:
20+
regex: 'MGatner'
21+
- must_exclude:
22+
regex: 'michalsn'
23+
- must_exclude:
24+
regex: 'paulbalandan'
25+
- must_exclude:
26+
regex: 'samsonasik'
27+
fail:
28+
- do: comment
29+
payload: |
30+
Hi there! :wave:
31+
32+
It looks like you opened an issue without following the bug report template:
33+
34+
Bug report ([open an issue](https://github.com/codeigniter4/CodeIgniter4/issues/new?assignees=&labels=bug&projects=&template=bug_report.yml&title=Bug%3A+))
35+
36+
If you are opening a feature request or support question, please do so in the [forums](https://forum.codeigniter.com/forum-30.html).
37+
38+
The current issue will be closed. This is a precaution to save maintainers' time, I hope you'll understand.
39+
40+
Sincerely, the mergeable bot 🤖
41+
- do: close

CHANGELOG.md

+12
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
11
# Changelog
22

3+
## [v4.5.7](https://github.com/codeigniter4/CodeIgniter4/tree/v4.5.7) (2024-12-31)
4+
[Full Changelog](https://github.com/codeigniter4/CodeIgniter4/compare/v4.5.6...v4.5.7)
5+
6+
### Fixed Bugs
7+
8+
* fix: handle namespaced helper found on Common helper by @samsonasik in https://github.com/codeigniter4/CodeIgniter4/pull/9354
9+
* fix: `Forge::dropColumn()` always returns `false` on SQLite3 driver by @paulbalandan in https://github.com/codeigniter4/CodeIgniter4/pull/9351
10+
11+
### Refactoring
12+
13+
* refactor: enable AddArrowFunctionReturnTypeRector by @samsonasik in https://github.com/codeigniter4/CodeIgniter4/pull/9343
14+
315
## [v4.5.6](https://github.com/codeigniter4/CodeIgniter4/tree/v4.5.6) (2024-12-28)
416
[Full Changelog](https://github.com/codeigniter4/CodeIgniter4/compare/v4.5.5...v4.5.6)
517

app/Views/errors/cli/error_exception.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
$function .= $padClass . $error['function'];
5151
}
5252

53-
$args = implode(', ', array_map(static fn ($value) => match (true) {
53+
$args = implode(', ', array_map(static fn ($value): string => match (true) {
5454
is_object($value) => 'Object(' . $value::class . ')',
5555
is_array($value) => $value !== [] ? '[...]' : '[]',
5656
$value === null => 'null', // return the lowercased version

phpdoc.dist.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<output>api/build/</output>
1111
<cache>api/cache/</cache>
1212
</paths>
13-
<version number="4.5.6">
13+
<version number="4.5.7">
1414
<api format="php">
1515
<source dsn=".">
1616
<path>system</path>

rector.php

+2
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
use Rector\Privatization\Rector\Property\PrivatizeFinalClassPropertyRector;
4242
use Rector\Strict\Rector\Empty_\DisallowedEmptyRuleFixerRector;
4343
use Rector\Strict\Rector\If_\BooleanInIfConditionRuleFixerRector;
44+
use Rector\TypeDeclaration\Rector\ArrowFunction\AddArrowFunctionReturnTypeRector;
4445
use Rector\TypeDeclaration\Rector\ClassMethod\AddMethodCallBasedStrictParamTypeRector;
4546
use Rector\TypeDeclaration\Rector\ClassMethod\ReturnNeverTypeRector;
4647
use Rector\TypeDeclaration\Rector\Closure\AddClosureVoidReturnTypeWhereNoReturnRector;
@@ -201,6 +202,7 @@
201202
TypedPropertyFromAssignsRector::class,
202203
ClosureReturnTypeRector::class,
203204
FlipTypeControlToUseExclusiveTypeRector::class,
205+
AddArrowFunctionReturnTypeRector::class,
204206
])
205207
->withConfiguredRule(StringClassNameToClassConstantRector::class, [
206208
// keep '\\' prefix string on string '\Foo\Bar'

system/CLI/CLI.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ public static function promptByMultipleKeys(string $text, array $options): array
339339
$pattern = preg_match_all('/^\d+(,\d+)*$/', trim($input));
340340

341341
// separate input by comma and convert all to an int[]
342-
$inputToArray = array_map(static fn ($value) => (int) $value, explode(',', $input));
342+
$inputToArray = array_map(static fn ($value): int => (int) $value, explode(',', $input));
343343
// find max from key of $options
344344
$maxOptions = array_key_last($options);
345345
// find max from input

system/CodeIgniter.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ class CodeIgniter
5656
/**
5757
* The current version of CodeIgniter Framework
5858
*/
59-
public const CI_VERSION = '4.5.6';
59+
public const CI_VERSION = '4.5.7';
6060

6161
/**
6262
* App startup time.

system/Commands/Utilities/Routes.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ public function run(array $params)
187187

188188
// Sort by Handler.
189189
if ($sortByHandler) {
190-
usort($tbody, static fn ($handler1, $handler2) => strcmp($handler1[3], $handler2[3]));
190+
usort($tbody, static fn ($handler1, $handler2): int => strcmp($handler1[3], $handler2[3]));
191191
}
192192

193193
if ($host !== null) {

system/Common.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -598,7 +598,7 @@ function helper($filenames): void
598598
if (str_contains($filename, '\\')) {
599599
$path = $loader->locateFile($filename, 'Helpers');
600600

601-
if ($path !== '') {
601+
if ($path === false) {
602602
throw FileNotFoundException::forFileNotFound($filename);
603603
}
604604

system/Database/BaseBuilder.php

+9-9
Original file line numberDiff line numberDiff line change
@@ -2018,7 +2018,7 @@ protected function _upsertBatch(string $table, array $keys, array $values): stri
20182018
$sql = 'INSERT INTO ' . $table . ' (' . implode(', ', $keys) . ")\n{:_table_:}ON DUPLICATE KEY UPDATE\n" . implode(
20192019
",\n",
20202020
array_map(
2021-
static fn ($key, $value) => $table . '.' . $key . ($value instanceof RawSql ?
2021+
static fn ($key, $value): string => $table . '.' . $key . ($value instanceof RawSql ?
20222022
' = ' . $value :
20232023
' = VALUES(' . $value . ')'),
20242024
array_keys($updateFields),
@@ -2108,7 +2108,7 @@ public function onConstraint($set)
21082108
if (is_string($set)) {
21092109
$set = explode(',', $set);
21102110

2111-
$set = array_map(static fn ($key) => trim($key), $set);
2111+
$set = array_map(static fn ($key): string => trim($key), $set);
21122112
}
21132113

21142114
if ($set instanceof RawSql) {
@@ -2152,7 +2152,7 @@ public function setQueryAsData($query, ?string $alias = null, $columns = null):
21522152
if (is_string($query)) {
21532153
if ($columns !== null && is_string($columns)) {
21542154
$columns = explode(',', $columns);
2155-
$columns = array_map(static fn ($key) => trim($key), $columns);
2155+
$columns = array_map(static fn ($key): string => trim($key), $columns);
21562156
}
21572157

21582158
$columns = (array) $columns;
@@ -2190,7 +2190,7 @@ protected function fieldsFromQuery(string $sql): array
21902190
*/
21912191
protected function formatValues(array $values): array
21922192
{
2193-
return array_map(static fn ($index) => '(' . implode(',', $index) . ')', $values);
2193+
return array_map(static fn ($index): string => '(' . implode(',', $index) . ')', $values);
21942194
}
21952195

21962196
/**
@@ -2649,7 +2649,7 @@ protected function _updateBatch(string $table, array $keys, array $values): stri
26492649
$sql .= implode(
26502650
",\n",
26512651
array_map(
2652-
static fn ($key, $value) => $key . ($value instanceof RawSql ?
2652+
static fn ($key, $value): string => $key . ($value instanceof RawSql ?
26532653
' = ' . $value :
26542654
' = ' . $alias . '.' . $value),
26552655
array_keys($updateFields),
@@ -2691,8 +2691,8 @@ protected function _updateBatch(string $table, array $keys, array $values): stri
26912691
$data = implode(
26922692
" UNION ALL\n",
26932693
array_map(
2694-
static fn ($value) => 'SELECT ' . implode(', ', array_map(
2695-
static fn ($key, $index) => $index . ' ' . $key,
2694+
static fn ($value): string => 'SELECT ' . implode(', ', array_map(
2695+
static fn ($key, $index): string => $index . ' ' . $key,
26962696
$keys,
26972697
$value
26982698
)),
@@ -2946,8 +2946,8 @@ protected function _deleteBatch(string $table, array $keys, array $values): stri
29462946
$data = implode(
29472947
" UNION ALL\n",
29482948
array_map(
2949-
static fn ($value) => 'SELECT ' . implode(', ', array_map(
2950-
static fn ($key, $index) => $index . ' ' . $key,
2949+
static fn ($value): string => 'SELECT ' . implode(', ', array_map(
2950+
static fn ($key, $index): string => $index . ' ' . $key,
29512951
$keys,
29522952
$value
29532953
)),

system/Database/Forge.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -778,7 +778,7 @@ public function addColumn(string $table, $fields): bool
778778
}
779779

780780
/**
781-
* @param array|string $columnNames column names to DROP
781+
* @param list<string>|string $columnNames column names to DROP
782782
*
783783
* @return bool
784784
*
@@ -861,7 +861,7 @@ protected function _alterTable(string $alterType, string $table, $processedField
861861
$columnNamesToDrop = explode(',', $columnNamesToDrop);
862862
}
863863

864-
$columnNamesToDrop = array_map(fn ($field) => 'DROP COLUMN ' . $this->db->escapeIdentifiers(trim($field)), $columnNamesToDrop);
864+
$columnNamesToDrop = array_map(fn ($field): string => 'DROP COLUMN ' . $this->db->escapeIdentifiers(trim($field)), $columnNamesToDrop);
865865

866866
return $sql . implode(', ', $columnNamesToDrop);
867867
}

system/Database/MySQLi/Builder.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ protected function _updateBatch(string $table, array $keys, array $values): stri
115115
$sql .= implode(
116116
",\n",
117117
array_map(
118-
static fn ($key, $value) => $table . '.' . $key . ($value instanceof RawSql ?
118+
static fn ($key, $value): string => $table . '.' . $key . ($value instanceof RawSql ?
119119
' = ' . $value :
120120
' = ' . $alias . '.' . $value),
121121
array_keys($updateFields),
@@ -132,8 +132,8 @@ protected function _updateBatch(string $table, array $keys, array $values): stri
132132
$data = implode(
133133
" UNION ALL\n",
134134
array_map(
135-
static fn ($value) => 'SELECT ' . implode(', ', array_map(
136-
static fn ($key, $index) => $index . ' ' . $key,
135+
static fn ($value): string => 'SELECT ' . implode(', ', array_map(
136+
static fn ($key, $index): string => $index . ' ' . $key,
137137
$keys,
138138
$value
139139
)),

system/Database/OCI8/Builder.php

+17-17
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,8 @@ protected function _insertBatch(string $table, array $keys, array $values): stri
8989
$data = implode(
9090
" FROM DUAL UNION ALL\n",
9191
array_map(
92-
static fn ($value) => 'SELECT ' . implode(', ', array_map(
93-
static fn ($key, $index) => $index . ' ' . $key,
92+
static fn ($value): string => 'SELECT ' . implode(', ', array_map(
93+
static fn ($key, $index): string => $index . ' ' . $key,
9494
$keys,
9595
$value
9696
)),
@@ -107,7 +107,7 @@ protected function _insertBatch(string $table, array $keys, array $values): stri
107107
*/
108108
protected function _replace(string $table, array $keys, array $values): string
109109
{
110-
$fieldNames = array_map(static fn ($columnName) => trim($columnName, '"'), $keys);
110+
$fieldNames = array_map(static fn ($columnName): string => trim($columnName, '"'), $keys);
111111

112112
$uniqueIndexes = array_filter($this->db->getIndexData($table), static function ($index) use ($fieldNames): bool {
113113
$hasAllFields = count(array_intersect($index->fields, $fieldNames)) === count($index->fields);
@@ -126,24 +126,24 @@ protected function _replace(string $table, array $keys, array $values): string
126126

127127
$sql = 'MERGE INTO ' . $table . "\n USING (SELECT ";
128128

129-
$sql .= implode(', ', array_map(static fn ($columnName, $value) => $value . ' ' . $columnName, $keys, $values));
129+
$sql .= implode(', ', array_map(static fn ($columnName, $value): string => $value . ' ' . $columnName, $keys, $values));
130130

131131
$sql .= ' FROM DUAL) "_replace" ON ( ';
132132

133133
$onList = [];
134134
$onList[] = '1 != 1';
135135

136136
foreach ($uniqueIndexes as $index) {
137-
$onList[] = '(' . implode(' AND ', array_map(static fn ($columnName) => $table . '."' . $columnName . '" = "_replace"."' . $columnName . '"', $index->fields)) . ')';
137+
$onList[] = '(' . implode(' AND ', array_map(static fn ($columnName): string => $table . '."' . $columnName . '" = "_replace"."' . $columnName . '"', $index->fields)) . ')';
138138
}
139139

140140
$sql .= implode(' OR ', $onList) . ') WHEN MATCHED THEN UPDATE SET ';
141141

142-
$sql .= implode(', ', array_map(static fn ($columnName) => $columnName . ' = "_replace".' . $columnName, $replaceableFields));
142+
$sql .= implode(', ', array_map(static fn ($columnName): string => $columnName . ' = "_replace".' . $columnName, $replaceableFields));
143143

144144
$sql .= ' WHEN NOT MATCHED THEN INSERT (' . implode(', ', $replaceableFields) . ') VALUES ';
145145

146-
return $sql . (' (' . implode(', ', array_map(static fn ($columnName) => '"_replace".' . $columnName, $replaceableFields)) . ')');
146+
return $sql . (' (' . implode(', ', array_map(static fn ($columnName): string => '"_replace".' . $columnName, $replaceableFields)) . ')');
147147
}
148148

149149
/**
@@ -298,7 +298,7 @@ protected function _updateBatch(string $table, array $keys, array $values): stri
298298
$sql .= implode(
299299
",\n",
300300
array_map(
301-
static fn ($key, $value) => $table . '.' . $key . ($value instanceof RawSql ?
301+
static fn ($key, $value): string => $table . '.' . $key . ($value instanceof RawSql ?
302302
' = ' . $value :
303303
' = ' . $alias . '.' . $value),
304304
array_keys($updateFields),
@@ -315,8 +315,8 @@ protected function _updateBatch(string $table, array $keys, array $values): stri
315315
$data = implode(
316316
" UNION ALL\n",
317317
array_map(
318-
static fn ($value) => 'SELECT ' . implode(', ', array_map(
319-
static fn ($key, $index) => $index . ' ' . $key,
318+
static fn ($value): string => 'SELECT ' . implode(', ', array_map(
319+
static fn ($key, $index): string => $index . ' ' . $key,
320320
$keys,
321321
$value
322322
)) . ' FROM DUAL',
@@ -342,7 +342,7 @@ protected function _upsertBatch(string $table, array $keys, array $values): stri
342342
$constraints = $this->QBOptions['constraints'] ?? [];
343343

344344
if (empty($constraints)) {
345-
$fieldNames = array_map(static fn ($columnName) => trim($columnName, '"'), $keys);
345+
$fieldNames = array_map(static fn ($columnName): string => trim($columnName, '"'), $keys);
346346

347347
$uniqueIndexes = array_filter($this->db->getIndexData($table), static function ($index) use ($fieldNames): bool {
348348
$hasAllFields = count(array_intersect($index->fields, $fieldNames)) === count($index->fields);
@@ -401,7 +401,7 @@ protected function _upsertBatch(string $table, array $keys, array $values): stri
401401
$sql .= implode(
402402
",\n",
403403
array_map(
404-
static fn ($key, $value) => $key . ($value instanceof RawSql ?
404+
static fn ($key, $value): string => $key . ($value instanceof RawSql ?
405405
" = {$value}" :
406406
" = {$alias}.{$value}"),
407407
array_keys($updateFields),
@@ -412,7 +412,7 @@ protected function _upsertBatch(string $table, array $keys, array $values): stri
412412
$sql .= "\nWHEN NOT MATCHED THEN INSERT (" . implode(', ', $keys) . ")\nVALUES ";
413413

414414
$sql .= (' ('
415-
. implode(', ', array_map(static fn ($columnName) => "{$alias}.{$columnName}", $keys))
415+
. implode(', ', array_map(static fn ($columnName): string => "{$alias}.{$columnName}", $keys))
416416
. ')');
417417

418418
$this->QBOptions['sql'] = $sql;
@@ -424,8 +424,8 @@ protected function _upsertBatch(string $table, array $keys, array $values): stri
424424
$data = implode(
425425
" FROM DUAL UNION ALL\n",
426426
array_map(
427-
static fn ($value) => 'SELECT ' . implode(', ', array_map(
428-
static fn ($key, $index) => $index . ' ' . $key,
427+
static fn ($value): string => 'SELECT ' . implode(', ', array_map(
428+
static fn ($key, $index): string => $index . ' ' . $key,
429429
$keys,
430430
$value
431431
)),
@@ -503,8 +503,8 @@ protected function _deleteBatch(string $table, array $keys, array $values): stri
503503
$data = implode(
504504
" FROM DUAL UNION ALL\n",
505505
array_map(
506-
static fn ($value) => 'SELECT ' . implode(', ', array_map(
507-
static fn ($key, $index) => $index . ' ' . $key,
506+
static fn ($value): string => 'SELECT ' . implode(', ', array_map(
507+
static fn ($key, $index): string => $index . ' ' . $key,
508508
$keys,
509509
$value
510510
)),

system/Database/OCI8/Result.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public function getFieldCount(): int
3737
*/
3838
public function getFieldNames(): array
3939
{
40-
return array_map(fn ($fieldIndex) => oci_field_name($this->resultID, $fieldIndex), range(1, $this->getFieldCount()));
40+
return array_map(fn ($fieldIndex): false|string => oci_field_name($this->resultID, $fieldIndex), range(1, $this->getFieldCount()));
4141
}
4242

4343
/**

0 commit comments

Comments
 (0)