Skip to content

Commit

Permalink
Merge pull request #6445 from codeigniter4/develop
Browse files Browse the repository at this point in the history
4.2.5 Ready code
  • Loading branch information
MGatner authored Aug 29, 2022
2 parents 459e00e + 800c2c1 commit d51d4e9
Show file tree
Hide file tree
Showing 115 changed files with 1,477 additions and 1,453 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/test-rector.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ on:
- 'utils/**.php'
- '.github/workflows/test-rector.yml'
- composer.json
- rector.php

push:
branches:
Expand All @@ -26,6 +27,7 @@ on:
- 'utils/**.php'
- '.github/workflows/test-rector.yml'
- composer.json
- rector.php

jobs:
build:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/test-userguide.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,4 @@ jobs:
- uses: ammaraskar/[email protected]
with:
docs-folder: user_guide_src
build-command: 'make html SPHINXOPTS="-W --keep-going -w /tmp/sphinx-log"'
6 changes: 5 additions & 1 deletion .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,11 @@
__DIR__ . '/tests',
__DIR__ . '/utils',
])
->exclude(['ThirdParty'])
->exclude([
'Pager/Views',
'ThirdParty',
'Validation/Views',
])
->notName('#Foobar.php$#')
->append([
__FILE__,
Expand Down
1 change: 1 addition & 0 deletions .php-cs-fixer.no-header.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
__DIR__ . '/app',
__DIR__ . '/public',
])
->exclude(['Views/errors/html'])
->notName('#Logger\.php$#')
->append([
__DIR__ . '/admin/starter/builds',
Expand Down
26 changes: 26 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,31 @@
# Changelog

## [v4.2.5](https://github.com/codeigniter4/CodeIgniter4/tree/v4.2.5) (2022-08-28)
[Full Changelog](https://github.com/codeigniter4/CodeIgniter4/compare/v4.2.4...v4.2.5)

### Breaking Changes
* Add $cached param to BaseConnection::tableExists() by @sclubricants in https://github.com/codeigniter4/CodeIgniter4/pull/6364
* Fix validation custom error asterisk field by @ping-yee in https://github.com/codeigniter4/CodeIgniter4/pull/6378

### Fixed Bugs
* fix: Email class may not log an error when it fails to send by @kenjis in https://github.com/codeigniter4/CodeIgniter4/pull/6362
* fix: Response::download() causes TypeError by @kenjis in https://github.com/codeigniter4/CodeIgniter4/pull/6361
* fix: command usages by @kenjis in https://github.com/codeigniter4/CodeIgniter4/pull/6402
* Fix: The subquery adds a prefix for the table alias. by @iRedds in https://github.com/codeigniter4/CodeIgniter4/pull/6390
* Fix Sqlite Table::createTable() by @sclubricants in https://github.com/codeigniter4/CodeIgniter4/pull/6396
* docs: add missing `@method` `groupBy()` in Model by @kenjis in https://github.com/codeigniter4/CodeIgniter4/pull/6433
* fix: CLIRequest Erros in CLI by @kenjis in https://github.com/codeigniter4/CodeIgniter4/pull/6421
* fix: Call to undefined method CodeIgniter\HTTP\CLIRequest::getLocale() by @kenjis in https://github.com/codeigniter4/CodeIgniter4/pull/6442

### Enhancements
* chore: update Kint to 4.2.0 by @kenjis in https://github.com/codeigniter4/CodeIgniter4/pull/6436

### Refactoring
* refactor: add test for DownloadResponse by @kenjis in https://github.com/codeigniter4/CodeIgniter4/pull/6375
* refactor: ValidationTest by @kenjis in https://github.com/codeigniter4/CodeIgniter4/pull/6382
* refactor: remove unused `_parent_name` in BaseBuilder::objectToArray() by @kenjis in https://github.com/codeigniter4/CodeIgniter4/pull/6427
* Remove unneeded abstract `handle()` method by @paulbalandan in https://github.com/codeigniter4/CodeIgniter4/pull/6434

## [v4.2.4](https://github.com/codeigniter4/CodeIgniter4/tree/v4.2.4) (2022-08-13)
[Full Changelog](https://github.com/codeigniter4/CodeIgniter4/compare/v4.2.3...v4.2.4)

Expand Down
15 changes: 13 additions & 2 deletions admin/framework/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"ext-intl": "*",
"ext-json": "*",
"ext-mbstring": "*",
"kint-php/kint": "^4.1.1",
"kint-php/kint": "^4.2",
"laminas/laminas-escaper": "^2.9",
"psr/log": "^1.1"
},
Expand All @@ -24,7 +24,18 @@
"predis/predis": "^1.1 || ^2.0"
},
"suggest": {
"ext-fileinfo": "Improves mime type detection for files"
"ext-imagick": "If you use Image class ImageMagickHandler",
"ext-simplexml": "If you format XML",
"ext-mysqli": "If you use MySQL",
"ext-oci8": "If you use Oracle Database",
"ext-pgsql": "If you use PostgreSQL",
"ext-sqlsrv": "If you use SQL Server",
"ext-sqlite3": "If you use SQLite3",
"ext-memcache": "If you use Cache class MemcachedHandler with Memcache",
"ext-memcached": "If you use Cache class MemcachedHandler with Memcached",
"ext-redis": "If you use Cache class RedisHandler",
"ext-fileinfo": "Improves mime type detection for files",
"ext-readline": "Improves CLI::input() usability"
},
"autoload": {
"psr-4": {
Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"ext-intl": "*",
"ext-json": "*",
"ext-mbstring": "*",
"kint-php/kint": "^4.1.1",
"kint-php/kint": "^4.2",
"laminas/laminas-escaper": "^2.9",
"psr/log": "^1.1"
},
Expand All @@ -24,7 +24,7 @@
"phpstan/phpstan": "^1.7.1",
"phpunit/phpunit": "^9.1",
"predis/predis": "^1.1 || ^2.0",
"rector/rector": "0.13.10"
"rector/rector": "0.14.0"
},
"suggest": {
"ext-imagick": "If you use Image class ImageMagickHandler",
Expand Down
7 changes: 5 additions & 2 deletions contributing/documentation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,9 @@ To a URL
To a Function
=============

:php:func:`dot_array_search`
:php:func:`dot_array_search()`

:php:func:`Response::setCookie() <setCookie>`
To a Method
=============

:php:meth:`CodeIgniter\\HTTP\\Response::setCookie()`
13 changes: 6 additions & 7 deletions contributing/pull_request.md
Original file line number Diff line number Diff line change
Expand Up @@ -249,18 +249,17 @@ The best way to contribute is to fork the CodeIgniter4 repository, and "clone" t
7. Fix existing bugs on the [Issue tracker](https://github.com/codeigniter4/CodeIgniter4/issues) after confirming that no one else is working on them.
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.
- `> git commit`
- 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.
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.
10. If you have touched PHP code, run static analysis.
- 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.
9. If you have touched PHP code, run static analysis.
- `> composer analyze`
- `> vendor/bin/rector process`
11. Run unit tests on the specific file you modified. If there are no existing tests yet, please create one.
10. Run unit tests on the specific file you modified. If there are no existing tests yet, please create one.
- `> vendor/bin/phpunit tests/system/path/to/file/you/modified`
- Make sure the tests pass to have a higher chance of merging.
12. [Push](https://docs.github.com/en/github/using-git/pushing-commits-to-a-remote-repository) your contribution branch to your fork.
11. [Push](https://docs.github.com/en/github/using-git/pushing-commits-to-a-remote-repository) your contribution branch to your fork.
- `> git push origin <new-branch-name>`
13. Send a [pull request](https://docs.github.com/en/github/collaborating-with-issues-and-pull-requests/creating-a-pull-request-from-a-fork).
14. Label your pull request with the appropriate label if you can.
12. Send a [pull request](https://docs.github.com/en/github/collaborating-with-issues-and-pull-requests/creating-a-pull-request-from-a-fork).
13. Label your pull request with the appropriate label if you can.

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

Expand Down
10 changes: 1 addition & 9 deletions contributing/signing.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,4 @@ bash shell to use the **-S** option to force the secure signing.
## Commit Messages

Regardless of how you sign a commit, commit messages are important too.
They communicate the intent of a specific change, concisely. They make
it easier to review code, and to find out why a change was made if the
code history is examined later.

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

Make your commit messages meaningful.
See [Contribution Workflow](./workflow.md#commit-messages) for details.
106 changes: 99 additions & 7 deletions contributing/workflow.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@ is normally done locally, so that you can resolve any merge conflicts.
For instance, to synchronize **develop** branches:

```console
> git switch develop
> git fetch upstream
> git switch develop
> git merge upstream/develop
> git push origin develop
```
Expand Down Expand Up @@ -139,16 +139,48 @@ Your local changes need to be *committed* to save them in your local
repository. This is where [contribution signing](./signing.md) comes
in.

Now we don't have detailed rules on commits and its messages. But
[atomic commit](https://en.wikipedia.org/wiki/Atomic_commit#Atomic_commit_convention) is recommended.
Keep your commits atomic. One commit for one change.

There are some references for writing good commit messages:

- [Git Best Practices — AFTER Technique - DZone DevOps](https://dzone.com/articles/git-best-practices-after-technique-1)
- [Semantic Commit Messages](https://gist.github.com/joshbuchea/6f47e86d2510bce28f8e7f42ae84c716)
- [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/)

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

### Commit Messages

Commit messages are important. They communicate the intent of a specific change, concisely.
They make it easier to review code, and to find out why a change was made
if the code history is examined later.

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

Make your commit messages meaningful.

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.

You can have as many commits in a branch as you need to "get it right".
For instance, to commit your work from a debugging session:

```console
> git add .
> git commit -S -m "Find and fix the broken reference problem"
> git commit -S -m "Fix the broken reference problem"
```

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

### When you work on two features

If you are working on two features at a time, then you will want to
switch between them to keep the contributions separate. For instance:

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

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

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

Synchronize your repository:

```console
> git switch develop
> git fetch upstream
> git switch develop
> git merge upstream/develop
> git push origin develop
```
Expand Down Expand Up @@ -213,7 +245,7 @@ Make sure that the PR title is helpful for the maintainers and other
developers. Add any comments appropriate, for instance asking for
review.

**Note:**
> **Note**
> If you do not provide a title or description for your PR, the odds of it being summarily rejected
rise astronomically.

Expand Down Expand Up @@ -253,12 +285,18 @@ do the following:
Synchronize your repository:

```console
> git switch develop
> git fetch upstream
> git switch develop
> git merge upstream/develop
> git push origin develop
```

(Optional) Create a new branch as a backup, just in case:

```console
> git branch fix/problem123.bk fix/problem123
```

Bring your feature branch up to date:

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

## If you sent to the wrong branch

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

When you have the PR branch `feat-abc` and you should have sent the PR to `4.3`,
but you created the PR branch from `develop` and sent a PR.

Copy the IDs of any commits you made that you want to keep:

```console
> git log
```

Update your `4.3` branch:

```console
> git fetch upstream
> git switch 4.3
> git merge upstream/4.3
> git push origin 4.3
```

Create a new branch `feat-ab.new` from the correct branch `4.3`:

```console
> git switch -c feat-abc.new 4.3
```

Cherry-pick the commits you did:

```console
> git cherry-pick <commit_id> <commit_id> <commit_id> ...
```

Rename the PR branch `feat-abc`:

```console
> git branch -m feat-abc feat-abc.old
```

Rename the new branch `feat-abc.new` to `feat-abc`.

```console
> git branch -m feat-abc.new feat-abc
```

Force push.

```console
> git push --force-with-lease origin feat-abc
```

On the GitHub PR page, change the base branch to the correct branch `4.3`.

## Cleanup

If your PR is accepted and merged into the shared repository, you can
Expand Down
2 changes: 1 addition & 1 deletion env
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
# database.default.port = 3306

# database.tests.hostname = localhost
# database.tests.database = ci4
# database.tests.database = ci4_test
# database.tests.username = root
# database.tests.password = root
# database.tests.DBDriver = MySQLi
Expand Down
13 changes: 0 additions & 13 deletions rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@
use Rector\CodingStyle\Rector\FuncCall\CountArrayToEmptyArrayComparisonRector;
use Rector\Config\RectorConfig;
use Rector\DeadCode\Rector\ClassMethod\RemoveUnusedPrivateMethodRector;
use Rector\DeadCode\Rector\If_\RemoveAlwaysTrueIfConditionRector;
use Rector\DeadCode\Rector\If_\UnwrapFutureCompatibleIfPhpVersionRector;
use Rector\DeadCode\Rector\MethodCall\RemoveEmptyMethodCallRector;
use Rector\EarlyReturn\Rector\Foreach_\ChangeNestedForeachIfsToEarlyContinueRector;
use Rector\EarlyReturn\Rector\If_\ChangeIfElseValueAssignToEarlyReturnRector;
Expand Down Expand Up @@ -94,11 +92,6 @@
__DIR__ . '/tests',
],

// check on constant compare
UnwrapFutureCompatibleIfPhpVersionRector::class => [
__DIR__ . '/system/CodeIgniter.php',
],

// session handlers have the gc() method with underscored parameter `$max_lifetime`
UnderscoreToCamelCaseVariableNameRector::class => [
__DIR__ . '/system/Session/Handlers',
Expand Down Expand Up @@ -130,12 +123,6 @@
GetMockBuilderGetMockToCreateMockRector::class => [
__DIR__ . '/tests/system/Email/EmailTest.php',
],

// buggy on read based on @var on property on Trait
RemoveAlwaysTrueIfConditionRector::class => [
'**Trait.php',
__DIR__ . '/system/Test/ControllerTester.php',
],
]);

// auto import fully qualified class names
Expand Down
Loading

0 comments on commit d51d4e9

Please sign in to comment.