Skip to content

Commit d51d4e9

Browse files
authored
Merge pull request #6445 from codeigniter4/develop
4.2.5 Ready code
2 parents 459e00e + 800c2c1 commit d51d4e9

File tree

115 files changed

+1477
-1453
lines changed

Some content is hidden

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

115 files changed

+1477
-1453
lines changed

.github/workflows/test-rector.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ on:
1414
- 'utils/**.php'
1515
- '.github/workflows/test-rector.yml'
1616
- composer.json
17+
- rector.php
1718

1819
push:
1920
branches:
@@ -26,6 +27,7 @@ on:
2627
- 'utils/**.php'
2728
- '.github/workflows/test-rector.yml'
2829
- composer.json
30+
- rector.php
2931

3032
jobs:
3133
build:

.github/workflows/test-userguide.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,4 @@ jobs:
2525
- uses: ammaraskar/[email protected]
2626
with:
2727
docs-folder: user_guide_src
28+
build-command: 'make html SPHINXOPTS="-W --keep-going -w /tmp/sphinx-log"'

.php-cs-fixer.dist.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,11 @@
2525
__DIR__ . '/tests',
2626
__DIR__ . '/utils',
2727
])
28-
->exclude(['ThirdParty'])
28+
->exclude([
29+
'Pager/Views',
30+
'ThirdParty',
31+
'Validation/Views',
32+
])
2933
->notName('#Foobar.php$#')
3034
->append([
3135
__FILE__,

.php-cs-fixer.no-header.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
__DIR__ . '/app',
2626
__DIR__ . '/public',
2727
])
28+
->exclude(['Views/errors/html'])
2829
->notName('#Logger\.php$#')
2930
->append([
3031
__DIR__ . '/admin/starter/builds',

CHANGELOG.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,31 @@
11
# Changelog
22

3+
## [v4.2.5](https://github.com/codeigniter4/CodeIgniter4/tree/v4.2.5) (2022-08-28)
4+
[Full Changelog](https://github.com/codeigniter4/CodeIgniter4/compare/v4.2.4...v4.2.5)
5+
6+
### Breaking Changes
7+
* Add $cached param to BaseConnection::tableExists() by @sclubricants in https://github.com/codeigniter4/CodeIgniter4/pull/6364
8+
* Fix validation custom error asterisk field by @ping-yee in https://github.com/codeigniter4/CodeIgniter4/pull/6378
9+
10+
### Fixed Bugs
11+
* fix: Email class may not log an error when it fails to send by @kenjis in https://github.com/codeigniter4/CodeIgniter4/pull/6362
12+
* fix: Response::download() causes TypeError by @kenjis in https://github.com/codeigniter4/CodeIgniter4/pull/6361
13+
* fix: command usages by @kenjis in https://github.com/codeigniter4/CodeIgniter4/pull/6402
14+
* Fix: The subquery adds a prefix for the table alias. by @iRedds in https://github.com/codeigniter4/CodeIgniter4/pull/6390
15+
* Fix Sqlite Table::createTable() by @sclubricants in https://github.com/codeigniter4/CodeIgniter4/pull/6396
16+
* docs: add missing `@method` `groupBy()` in Model by @kenjis in https://github.com/codeigniter4/CodeIgniter4/pull/6433
17+
* fix: CLIRequest Erros in CLI by @kenjis in https://github.com/codeigniter4/CodeIgniter4/pull/6421
18+
* fix: Call to undefined method CodeIgniter\HTTP\CLIRequest::getLocale() by @kenjis in https://github.com/codeigniter4/CodeIgniter4/pull/6442
19+
20+
### Enhancements
21+
* chore: update Kint to 4.2.0 by @kenjis in https://github.com/codeigniter4/CodeIgniter4/pull/6436
22+
23+
### Refactoring
24+
* refactor: add test for DownloadResponse by @kenjis in https://github.com/codeigniter4/CodeIgniter4/pull/6375
25+
* refactor: ValidationTest by @kenjis in https://github.com/codeigniter4/CodeIgniter4/pull/6382
26+
* refactor: remove unused `_parent_name` in BaseBuilder::objectToArray() by @kenjis in https://github.com/codeigniter4/CodeIgniter4/pull/6427
27+
* Remove unneeded abstract `handle()` method by @paulbalandan in https://github.com/codeigniter4/CodeIgniter4/pull/6434
28+
329
## [v4.2.4](https://github.com/codeigniter4/CodeIgniter4/tree/v4.2.4) (2022-08-13)
430
[Full Changelog](https://github.com/codeigniter4/CodeIgniter4/compare/v4.2.3...v4.2.4)
531

admin/framework/composer.json

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"ext-intl": "*",
1111
"ext-json": "*",
1212
"ext-mbstring": "*",
13-
"kint-php/kint": "^4.1.1",
13+
"kint-php/kint": "^4.2",
1414
"laminas/laminas-escaper": "^2.9",
1515
"psr/log": "^1.1"
1616
},
@@ -24,7 +24,18 @@
2424
"predis/predis": "^1.1 || ^2.0"
2525
},
2626
"suggest": {
27-
"ext-fileinfo": "Improves mime type detection for files"
27+
"ext-imagick": "If you use Image class ImageMagickHandler",
28+
"ext-simplexml": "If you format XML",
29+
"ext-mysqli": "If you use MySQL",
30+
"ext-oci8": "If you use Oracle Database",
31+
"ext-pgsql": "If you use PostgreSQL",
32+
"ext-sqlsrv": "If you use SQL Server",
33+
"ext-sqlite3": "If you use SQLite3",
34+
"ext-memcache": "If you use Cache class MemcachedHandler with Memcache",
35+
"ext-memcached": "If you use Cache class MemcachedHandler with Memcached",
36+
"ext-redis": "If you use Cache class RedisHandler",
37+
"ext-fileinfo": "Improves mime type detection for files",
38+
"ext-readline": "Improves CLI::input() usability"
2839
},
2940
"autoload": {
3041
"psr-4": {

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"ext-intl": "*",
1111
"ext-json": "*",
1212
"ext-mbstring": "*",
13-
"kint-php/kint": "^4.1.1",
13+
"kint-php/kint": "^4.2",
1414
"laminas/laminas-escaper": "^2.9",
1515
"psr/log": "^1.1"
1616
},
@@ -24,7 +24,7 @@
2424
"phpstan/phpstan": "^1.7.1",
2525
"phpunit/phpunit": "^9.1",
2626
"predis/predis": "^1.1 || ^2.0",
27-
"rector/rector": "0.13.10"
27+
"rector/rector": "0.14.0"
2828
},
2929
"suggest": {
3030
"ext-imagick": "If you use Image class ImageMagickHandler",

contributing/documentation.rst

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,9 @@ To a URL
124124
To a Function
125125
=============
126126

127-
:php:func:`dot_array_search`
127+
:php:func:`dot_array_search()`
128128

129-
:php:func:`Response::setCookie() <setCookie>`
129+
To a Method
130+
=============
131+
132+
:php:meth:`CodeIgniter\\HTTP\\Response::setCookie()`

contributing/pull_request.md

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -249,18 +249,17 @@ The best way to contribute is to fork the CodeIgniter4 repository, and "clone" t
249249
7. Fix existing bugs on the [Issue tracker](https://github.com/codeigniter4/CodeIgniter4/issues) after confirming that no one else is working on them.
250250
8. [Commit](https://help.github.com/en/desktop/contributing-to-projects/committing-and-reviewing-changes-to-your-project) the changed files in your contribution branch.
251251
- `> git commit`
252-
- Commit messages are expected to be descriptive of what you changed specifically. Commit messages like "Fixes #1234" would be asked by the reviewer to be revised.
253-
9. If there are intermediate commits that are not meaningful to the overall PR, such as "Fixed error on style guide", "Fixed phpstan error", "Fixing mistake in code", and other related commits, it is advised to squash your commits so that we can have a clean commit history.
254-
10. If you have touched PHP code, run static analysis.
252+
- Commit messages are expected to be descriptive of why and what you changed specifically. Commit messages like "Fixes #1234" would be asked by the reviewer to be revised. [Atomic commit](https://en.wikipedia.org/wiki/Atomic_commit#Atomic_commit_convention) is recommended. See [Contribution Workflow](./workflow.md#commit-messages) for details.
253+
9. If you have touched PHP code, run static analysis.
255254
- `> composer analyze`
256255
- `> vendor/bin/rector process`
257-
11. Run unit tests on the specific file you modified. If there are no existing tests yet, please create one.
256+
10. Run unit tests on the specific file you modified. If there are no existing tests yet, please create one.
258257
- `> vendor/bin/phpunit tests/system/path/to/file/you/modified`
259258
- Make sure the tests pass to have a higher chance of merging.
260-
12. [Push](https://docs.github.com/en/github/using-git/pushing-commits-to-a-remote-repository) your contribution branch to your fork.
259+
11. [Push](https://docs.github.com/en/github/using-git/pushing-commits-to-a-remote-repository) your contribution branch to your fork.
261260
- `> git push origin <new-branch-name>`
262-
13. Send a [pull request](https://docs.github.com/en/github/collaborating-with-issues-and-pull-requests/creating-a-pull-request-from-a-fork).
263-
14. Label your pull request with the appropriate label if you can.
261+
12. Send a [pull request](https://docs.github.com/en/github/collaborating-with-issues-and-pull-requests/creating-a-pull-request-from-a-fork).
262+
13. Label your pull request with the appropriate label if you can.
264263

265264
See [Contribution workflow](./workflow.md) for Git workflow details.
266265

contributing/signing.md

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,4 @@ bash shell to use the **-S** option to force the secure signing.
5252
## Commit Messages
5353

5454
Regardless of how you sign a commit, commit messages are important too.
55-
They communicate the intent of a specific change, concisely. They make
56-
it easier to review code, and to find out why a change was made if the
57-
code history is examined later.
58-
59-
The audience for your commit messages will be the codebase maintainers,
60-
any code reviewers, and debuggers trying to figure out when a bug might
61-
have been introduced.
62-
63-
Make your commit messages meaningful.
55+
See [Contribution Workflow](./workflow.md#commit-messages) for details.

contributing/workflow.md

Lines changed: 99 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,8 @@ is normally done locally, so that you can resolve any merge conflicts.
8383
For instance, to synchronize **develop** branches:
8484

8585
```console
86-
> git switch develop
8786
> git fetch upstream
87+
> git switch develop
8888
> git merge upstream/develop
8989
> git push origin develop
9090
```
@@ -139,16 +139,48 @@ Your local changes need to be *committed* to save them in your local
139139
repository. This is where [contribution signing](./signing.md) comes
140140
in.
141141

142+
Now we don't have detailed rules on commits and its messages. But
143+
[atomic commit](https://en.wikipedia.org/wiki/Atomic_commit#Atomic_commit_convention) is recommended.
144+
Keep your commits atomic. One commit for one change.
145+
146+
There are some references for writing good commit messages:
147+
148+
- [Git Best Practices — AFTER Technique - DZone DevOps](https://dzone.com/articles/git-best-practices-after-technique-1)
149+
- [Semantic Commit Messages](https://gist.github.com/joshbuchea/6f47e86d2510bce28f8e7f42ae84c716)
150+
- [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/)
151+
152+
If there are intermediate commits that are not meaningful to the overall PR,
153+
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.
156+
157+
### Commit Messages
158+
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+
163+
The audience for your commit messages will be the codebase maintainers,
164+
any code reviewers, and debuggers trying to figure out when a bug might
165+
have been introduced.
166+
167+
Make your commit messages meaningful.
168+
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.
171+
142172
You can have as many commits in a branch as you need to "get it right".
143173
For instance, to commit your work from a debugging session:
144174

145175
```console
146176
> git add .
147-
> git commit -S -m "Find and fix the broken reference problem"
177+
> git commit -S -m "Fix the broken reference problem"
148178
```
149179

150180
Just make sure that your commits in a feature branch are all related.
151181

182+
### When you work on two features
183+
152184
If you are working on two features at a time, then you will want to
153185
switch between them to keep the contributions separate. For instance:
154186

@@ -164,7 +196,7 @@ switch between them to keep the contributions separate. For instance:
164196
> git switch develop
165197
```
166198

167-
The last checkout makes sure that you end up in your *develop* branch as
199+
The last switch makes sure that you end up in your *develop* branch as
168200
a starting point for your next session working with your repository.
169201
This is a good practice, as it is not always obvious which branch you
170202
are working in.
@@ -174,15 +206,15 @@ are working in.
174206
At some point, you will decide that your feature branch is complete, or
175207
that it could benefit from a review by fellow developers.
176208

177-
**Note:**
209+
> **Note**
178210
> Remember to sync your local repo with the shared one before pushing!
179211
It is a lot easier to resolve conflicts at this stage.
180212

181213
Synchronize your repository:
182214

183215
```console
184-
> git switch develop
185216
> git fetch upstream
217+
> git switch develop
186218
> git merge upstream/develop
187219
> git push origin develop
188220
```
@@ -213,7 +245,7 @@ Make sure that the PR title is helpful for the maintainers and other
213245
developers. Add any comments appropriate, for instance asking for
214246
review.
215247

216-
**Note:**
248+
> **Note**
217249
> If you do not provide a title or description for your PR, the odds of it being summarily rejected
218250
rise astronomically.
219251

@@ -253,12 +285,18 @@ do the following:
253285
Synchronize your repository:
254286

255287
```console
256-
> git switch develop
257288
> git fetch upstream
289+
> git switch develop
258290
> git merge upstream/develop
259291
> git push origin develop
260292
```
261293

294+
(Optional) Create a new branch as a backup, just in case:
295+
296+
```console
297+
> git branch fix/problem123.bk fix/problem123
298+
```
299+
262300
Bring your feature branch up to date:
263301

264302
```console
@@ -276,6 +314,60 @@ And finally push your local branch to your GitHub repository:
276314
> git push --force-with-lease origin fix/problem123
277315
```
278316

317+
## If you sent to the wrong branch
318+
319+
If you have sent a PR to the wrong branch, you need to create a new PR branch.
320+
321+
When you have the PR branch `feat-abc` and you should have sent the PR to `4.3`,
322+
but you created the PR branch from `develop` and sent a PR.
323+
324+
Copy the IDs of any commits you made that you want to keep:
325+
326+
```console
327+
> git log
328+
```
329+
330+
Update your `4.3` branch:
331+
332+
```console
333+
> git fetch upstream
334+
> git switch 4.3
335+
> git merge upstream/4.3
336+
> git push origin 4.3
337+
```
338+
339+
Create a new branch `feat-ab.new` from the correct branch `4.3`:
340+
341+
```console
342+
> git switch -c feat-abc.new 4.3
343+
```
344+
345+
Cherry-pick the commits you did:
346+
347+
```console
348+
> git cherry-pick <commit_id> <commit_id> <commit_id> ...
349+
```
350+
351+
Rename the PR branch `feat-abc`:
352+
353+
```console
354+
> git branch -m feat-abc feat-abc.old
355+
```
356+
357+
Rename the new branch `feat-abc.new` to `feat-abc`.
358+
359+
```console
360+
> git branch -m feat-abc.new feat-abc
361+
```
362+
363+
Force push.
364+
365+
```console
366+
> git push --force-with-lease origin feat-abc
367+
```
368+
369+
On the GitHub PR page, change the base branch to the correct branch `4.3`.
370+
279371
## Cleanup
280372

281373
If your PR is accepted and merged into the shared repository, you can

env

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
# database.default.port = 3306
4949

5050
# database.tests.hostname = localhost
51-
# database.tests.database = ci4
51+
# database.tests.database = ci4_test
5252
# database.tests.username = root
5353
# database.tests.password = root
5454
# database.tests.DBDriver = MySQLi

rector.php

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,6 @@
2929
use Rector\CodingStyle\Rector\FuncCall\CountArrayToEmptyArrayComparisonRector;
3030
use Rector\Config\RectorConfig;
3131
use Rector\DeadCode\Rector\ClassMethod\RemoveUnusedPrivateMethodRector;
32-
use Rector\DeadCode\Rector\If_\RemoveAlwaysTrueIfConditionRector;
33-
use Rector\DeadCode\Rector\If_\UnwrapFutureCompatibleIfPhpVersionRector;
3432
use Rector\DeadCode\Rector\MethodCall\RemoveEmptyMethodCallRector;
3533
use Rector\EarlyReturn\Rector\Foreach_\ChangeNestedForeachIfsToEarlyContinueRector;
3634
use Rector\EarlyReturn\Rector\If_\ChangeIfElseValueAssignToEarlyReturnRector;
@@ -94,11 +92,6 @@
9492
__DIR__ . '/tests',
9593
],
9694

97-
// check on constant compare
98-
UnwrapFutureCompatibleIfPhpVersionRector::class => [
99-
__DIR__ . '/system/CodeIgniter.php',
100-
],
101-
10295
// session handlers have the gc() method with underscored parameter `$max_lifetime`
10396
UnderscoreToCamelCaseVariableNameRector::class => [
10497
__DIR__ . '/system/Session/Handlers',
@@ -130,12 +123,6 @@
130123
GetMockBuilderGetMockToCreateMockRector::class => [
131124
__DIR__ . '/tests/system/Email/EmailTest.php',
132125
],
133-
134-
// buggy on read based on @var on property on Trait
135-
RemoveAlwaysTrueIfConditionRector::class => [
136-
'**Trait.php',
137-
__DIR__ . '/system/Test/ControllerTester.php',
138-
],
139126
]);
140127

141128
// auto import fully qualified class names

0 commit comments

Comments
 (0)