Skip to content

Commit dfdc101

Browse files
committed
Merge remote-tracking branch 'upstream/develop' into 4.5
Conflicts: phpstan-baseline.php
2 parents f7dbcf6 + 65c6692 commit dfdc101

File tree

13 files changed

+189
-143
lines changed

13 files changed

+189
-143
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
"phpunit/phpcov": "^8.2",
3333
"phpunit/phpunit": "^9.1",
3434
"predis/predis": "^1.1 || ^2.0",
35-
"rector/rector": "0.19.2",
35+
"rector/rector": "0.19.5",
3636
"vimeo/psalm": "^5.0"
3737
},
3838
"replace": {

contributing/pull_request.md

Lines changed: 98 additions & 55 deletions
Large diffs are not rendered by default.

contributing/styleguide.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
This document declares a set of coding conventions and rules to be followed when contributing PHP code
44
to the CodeIgniter project.
55

6-
**Note:**
6+
> [!NOTE]
77
> While we would recommend it, there's no requirement that you follow these conventions and rules in your
88
own projects. Usage is discretionary within your projects but strictly enforceable within the framework.
99

@@ -200,7 +200,7 @@ conditions MUST always be at the beginning or at the end of the line, not a mix
200200
- The conditional operator, also known simply as the ternary operator, MUST be preceded and followed by at least one space around both the `?` and `:` characters.
201201
- When the middle operand of the conditional operator is omitted, the operator MUST follow the same style rules as other binary comparison operators.
202202

203-
**Note:**
203+
> [!NOTE]
204204
> All the preceding rules are quoted from PSR-12. You may visit its website to view the code block samples.
205205
206206
## Custom Conventions

contributing/workflow.md

Lines changed: 41 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,9 @@ values for when you try these:
1616

1717
## Branching
1818

19-
- All bug fix PRs should be sent to the __"develop"__ branch, this is where the next bug fix version will be developed.
20-
- PRs with any enhancement should be sent to next minor version branch, e.g. __"4.3"__
19+
- All bug fix PRs should be sent to the __"develop"__ branch, this is where the
20+
next bug fix version will be developed.
21+
- PRs with any enhancement should be sent to next minor version branch, e.g. __"4.5"__
2122

2223
The "master" branch will always contain the latest stable
2324
version and is kept clean so a "hotfix" (e.g: an emergency security
@@ -111,23 +112,25 @@ This local branch should be named appropriately, for instance
111112
"fix/problem123" or "new/mind-reader". The slashes in these branch names
112113
is optional, and implies a sort of namespacing if used.
113114

114-
- All bug fix PRs should be sent to the __"develop"__ branch, this is where the next bug fix version will be developed.
115-
- PRs with any enhancement should be sent to next minor version branch, e.g. __"4.3"__
115+
- All bug fix PRs should be sent to the __"develop"__ branch, this is where the
116+
next bug fix version will be developed.
117+
- PRs with any enhancement should be sent to next minor version branch, e.g. __"4.5"__
116118

117-
For instance, if you send a PR to __"develop"__ branch, make sure you are in the *develop* branch, and create a
118-
new bugfix branch, based on *develop*, for a new feature you are
119-
creating:
119+
For instance, if you send a PR to __"develop"__ branch, make sure you are in the
120+
*develop* branch, and create a new bugfix branch, based on *develop*, for a new
121+
feature you are creating:
120122

121123
```console
122124
> git switch develop
123125
> git switch -c fix/problem123
124126
```
125127

126-
If you send a PR with an enhancement, make sure you are in the *next minor version* branch,
127-
and create a new feature branch, based on, e.g., *4.3*, for a new feature you are creating:
128+
If you send a PR with an enhancement, make sure you are in the *next minor version*
129+
branch, and create a new feature branch, based on, e.g., __"4.5"__, for a new
130+
feature you are creating:
128131

129132
```console
130-
> git switch 4.3
133+
> git switch 4.5
131134
> git switch -c new/mind-reader
132135
```
133136

@@ -151,23 +154,24 @@ There are some references for writing good commit messages:
151154

152155
If there are intermediate commits that are not meaningful to the overall PR,
153156
such as "Fix error on style guide", "Fix phpstan error", "Fix mistake in code",
154-
and other related commits, you can squash your commits so that we can have a clean commit history.
155-
But it is not a must.
157+
and other related commits, you can squash your commits so that we can have a
158+
clean commit history. But it is not a must.
156159

157160
### Commit Messages
158161

159-
Commit messages are important. They communicate the intent of a specific change, concisely.
160-
They make it easier to review code, and to find out why a change was made
161-
if the code history is examined later.
162+
Commit messages are important. They communicate the intent of a specific change,
163+
concisely. They make it easier to review code, and to find out why a change was
164+
made if the code history is examined later.
162165

163166
The audience for your commit messages will be the codebase maintainers,
164167
any code reviewers, and debuggers trying to figure out when a bug might
165168
have been introduced.
166169

167170
Make your commit messages meaningful.
168171

169-
Commit messages are expected to be descriptive of **why** and what you changed specifically.
170-
Commit messages like "Fixes #1234" would be asked by the reviewer to be revised.
172+
Commit messages are expected to be descriptive of **why** and what you changed
173+
specifically. Commit messages like "Fixes #1234" would be asked by the reviewer
174+
to be revised.
171175

172176
You can have as many commits in a branch as you need to "get it right".
173177
For instance, to commit your work from a debugging session:
@@ -185,7 +189,8 @@ Just make sure that your commits in a feature branch are all related.
185189
186190
### GPG-Signing Old Commits
187191

188-
Any developer can forget GPG-signing their commits with the option `-S`, like `git commit -S -m 'Signed GPG'`. In such a case, all you need to do is the following:
192+
Any developer can forget GPG-signing their commits with the option `-S`, like
193+
`git commit -S -m 'Signed GPG'`. In such a case, all you need to do is the following:
189194

190195
Latest commit only:
191196
```console
@@ -235,7 +240,7 @@ are working in.
235240
At some point, you will decide that your feature branch is complete, or
236241
that it could benefit from a review by fellow developers.
237242

238-
> **Note**
243+
> [!NOTE]
239244
> Remember to sync your local repo with the shared one before pushing!
240245
It is a lot easier to resolve conflicts at this stage.
241246

@@ -267,16 +272,16 @@ On GitHub, you propose your changes one feature branch at a time, by
267272
switching to the branch you wish to contribute, and then clicking on
268273
"New pull request".
269274

270-
Make sure the pull request is for the shared __"develop"__ or next minor version branch, e.g. __"4.3"__, or it
271-
may be rejected.
275+
Make sure the pull request is for the shared __"develop"__ or next minor version
276+
branch, e.g. __"4.5"__, or it may be rejected.
272277

273278
Make sure that the PR title is helpful for the maintainers and other
274279
developers. Add any comments appropriate, for instance asking for
275280
review.
276281

277-
> **Note**
278-
> If you do not provide a title or description for your PR, the odds of it being summarily rejected
279-
rise astronomically.
282+
> [!NOTE]
283+
> If you do not provide a title or description for your PR, the odds of it being
284+
> summarily rejected rise astronomically.
280285
281286
When your PR is submitted, a continuous integration task will be
282287
triggered, running all the unit tests as well as any other checking we
@@ -306,9 +311,11 @@ And if your PRs have the breaking changes, label the following label:
306311

307312
## Updating Your Branch
308313

309-
If you are asked for changes in the review, commit the fix in your branch and push it to GitHub again.
314+
If you are asked for changes in the review, commit the fix in your branch and
315+
push it to GitHub again.
310316

311-
If the __"develop"__ or next minor version branch, e.g. __"4.3"__, progresses and conflicts arise that prevent merging, or if you are asked to *rebase*,
317+
If the __"develop"__ or next minor version branch, e.g. __"4.5"__, progresses
318+
and conflicts arise that prevent merging, or if you are asked to *rebase*,
312319
do the following:
313320

314321
Synchronize your repository:
@@ -347,7 +354,7 @@ And finally push your local branch to your GitHub repository:
347354

348355
If you have sent a PR to the wrong branch, you need to create a new PR branch.
349356

350-
When you have the PR branch `feat-abc` and you should have sent the PR to `4.3`,
357+
When you have the PR branch `feat-abc` and you should have sent the PR to __"4.5"__,
351358
but you created the PR branch from `develop` and sent a PR.
352359

353360
Copy the IDs of any commits you made that you want to keep:
@@ -356,13 +363,13 @@ Copy the IDs of any commits you made that you want to keep:
356363
> git log
357364
```
358365

359-
Update your `4.3` branch:
366+
Update your __"4.5"__ branch:
360367

361368
```console
362369
> git fetch upstream
363-
> git switch 4.3
364-
> git merge upstream/4.3
365-
> git push origin 4.3
370+
> git switch 4.5
371+
> git merge upstream/4.5
372+
> git push origin 4.5
366373
```
367374

368375
(Optional) Create a new branch as a backup, just in case:
@@ -371,10 +378,10 @@ Update your `4.3` branch:
371378
> git branch feat-abc.bk feat-abc
372379
```
373380

374-
Rebase your PR branch from `develop` onto `4.3`:
381+
Rebase your PR branch from `develop` onto __"4.5"__:
375382

376383
```console
377-
> git rebase --onto 4.3 develop feat-abc
384+
> git rebase --onto 4.5 develop feat-abc
378385
```
379386

380387
Force push.
@@ -383,7 +390,7 @@ Force push.
383390
> git push --force-with-lease origin feat-abc
384391
```
385392

386-
On the GitHub PR page, change the base branch to the correct branch `4.3`.
393+
On the GitHub PR page, change the base branch to the correct branch __"4.5"__.
387394

388395
## Cleanup
389396

phpstan-baseline.php

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2826,21 +2826,6 @@
28262826
'count' => 1,
28272827
'path' => __DIR__ . '/system/Test/PhpStreamWrapper.php',
28282828
];
2829-
$ignoreErrors[] = [
2830-
'message' => '#^Method CodeIgniter\\\\Test\\\\TestLogger\\:\\:cleanup\\(\\) has no return type specified\\.$#',
2831-
'count' => 1,
2832-
'path' => __DIR__ . '/system/Test/TestLogger.php',
2833-
];
2834-
$ignoreErrors[] = [
2835-
'message' => '#^Parameter \\#1 \\$level \\(string\\) of method CodeIgniter\\\\Test\\\\TestLogger\\:\\:log\\(\\) should be contravariant with parameter \\$level \\(mixed\\) of method Psr\\\\Log\\\\LoggerInterface\\:\\:log\\(\\)$#',
2836-
'count' => 1,
2837-
'path' => __DIR__ . '/system/Test/TestLogger.php',
2838-
];
2839-
$ignoreErrors[] = [
2840-
'message' => '#^Property CodeIgniter\\\\Test\\\\TestLogger\\:\\:\\$op_logs has no type specified\\.$#',
2841-
'count' => 1,
2842-
'path' => __DIR__ . '/system/Test/TestLogger.php',
2843-
];
28442829
$ignoreErrors[] = [
28452830
'message' => '#^Property CodeIgniter\\\\Throttle\\\\Throttler\\:\\:\\$testTime \\(int\\) on left side of \\?\\? is not nullable\\.$#',
28462831
'count' => 1,

system/Database/OCI8/Connection.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,8 +317,8 @@ protected function _fieldData(string $table): array
317317

318318
$retval[$i]->max_length = $length;
319319

320-
$retval[$i]->default = $query[$i]->DATA_DEFAULT;
321320
$retval[$i]->nullable = $query[$i]->NULLABLE === 'Y';
321+
$retval[$i]->default = $query[$i]->DATA_DEFAULT;
322322
}
323323

324324
return $retval;

system/Database/Postgre/Connection.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,9 +320,9 @@ protected function _fieldData(string $table): array
320320

321321
$retVal[$i]->name = $query[$i]->column_name;
322322
$retVal[$i]->type = $query[$i]->data_type;
323+
$retVal[$i]->max_length = $query[$i]->character_maximum_length > 0 ? $query[$i]->character_maximum_length : $query[$i]->numeric_precision;
323324
$retVal[$i]->nullable = $query[$i]->is_nullable === 'YES';
324325
$retVal[$i]->default = $query[$i]->column_default;
325-
$retVal[$i]->max_length = $query[$i]->character_maximum_length > 0 ? $query[$i]->character_maximum_length : $query[$i]->numeric_precision;
326326
}
327327

328328
return $retVal;

system/Database/SQLSRV/Connection.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -359,15 +359,15 @@ protected function _fieldData(string $table): array
359359
for ($i = 0, $c = count($query); $i < $c; $i++) {
360360
$retVal[$i] = new stdClass();
361361

362-
$retVal[$i]->name = $query[$i]->COLUMN_NAME;
363-
$retVal[$i]->type = $query[$i]->DATA_TYPE;
364-
$retVal[$i]->default = $query[$i]->COLUMN_DEFAULT;
362+
$retVal[$i]->name = $query[$i]->COLUMN_NAME;
363+
$retVal[$i]->type = $query[$i]->DATA_TYPE;
365364

366365
$retVal[$i]->max_length = $query[$i]->CHARACTER_MAXIMUM_LENGTH > 0
367366
? $query[$i]->CHARACTER_MAXIMUM_LENGTH
368367
: $query[$i]->NUMERIC_PRECISION;
369368

370369
$retVal[$i]->nullable = $query[$i]->IS_NULLABLE !== 'NO';
370+
$retVal[$i]->default = $query[$i]->COLUMN_DEFAULT;
371371
}
372372

373373
return $retVal;

system/Database/SQLite3/Connection.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,12 +274,12 @@ protected function _fieldData(string $table): array
274274
$retVal[$i]->name = $query[$i]->name;
275275
$retVal[$i]->type = $query[$i]->type;
276276
$retVal[$i]->max_length = null;
277+
$retVal[$i]->nullable = isset($query[$i]->notnull) && ! (bool) $query[$i]->notnull;
277278
$retVal[$i]->default = $query[$i]->dflt_value;
278279
// "pk" (either zero for columns that are not part of the primary key,
279280
// or the 1-based index of the column within the primary key).
280281
// https://www.sqlite.org/pragma.html#pragma_table_info
281282
$retVal[$i]->primary_key = ($query[$i]->pk === 0) ? 0 : 1;
282-
$retVal[$i]->nullable = isset($query[$i]->notnull) && ! (bool) $query[$i]->notnull;
283283
}
284284

285285
return $retVal;

system/Test/TestLogger.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,16 @@
2121
*/
2222
class TestLogger extends Logger
2323
{
24+
/**
25+
* @var list<array{level: mixed, message: string, file: string|null}>
26+
*/
2427
protected static $op_logs = [];
2528

2629
/**
2730
* The log method is overridden so that we can store log history during
2831
* the tests to allow us to check ->assertLogged() methods.
2932
*
30-
* @param string $level
33+
* @param mixed $level
3134
* @param string $message
3235
*/
3336
public function log($level, string|Stringable $message, array $context = []): void
@@ -95,6 +98,8 @@ public static function didLog(string $level, $message, bool $useExactComparison
9598
*
9699
* @param string $file
97100
*
101+
* @return string
102+
*
98103
* @deprecated No longer needed as underlying protected method is also deprecated.
99104
*/
100105
public function cleanup($file)

0 commit comments

Comments
 (0)