Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/develop' into 4.5
Browse files Browse the repository at this point in the history
  • Loading branch information
kenjis committed Sep 15, 2023
2 parents 28fe6ff + 642cf3b commit 2daf762
Show file tree
Hide file tree
Showing 11 changed files with 79 additions and 38 deletions.
32 changes: 14 additions & 18 deletions .github/workflows/label-conflict.yml
Original file line number Diff line number Diff line change
@@ -1,35 +1,31 @@
name: Auto Label Conflicts
name: Auto Comment Conflicts
on:
pull_request:
branches:
- 'develop'
- '4.*'
types:
- labeled

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

permissions:
contents: read
issues: write
pull-requests: write

jobs:
auto-label:
auto-comment-conflict:
permissions:
contents: read
pull-requests: write
if: github.event.label.name == 'stale'
runs-on: ubuntu-latest
steps:
- uses: prince-chrismc/label-merge-conflicts-action@v3
- name: Add comment for PR with conflict
uses: peter-evans/create-or-update-comment@v3
with:
conflict_label_name: 'stale'
github_token: ${{ github.token }}

# --- Optional Inputs ---
# To make sure the merge commit exactly matches the branch
detect_merge_changes: true # or true to handle as conflicts
# By default a comment will be left, adding `conflict_comment: ''` will disable comments
# The optional `${author}` will be replaced with the username of the pull request
conflict_comment: |
:wave: Hi, @${author},
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: ${{ github.event.pull_request.number }}
body: |
:wave: Hi, @${{ github.event.pull_request.user.login }}!
We detected conflicts in your PR against the base branch :speak_no_evil:
You may want to sync :arrows_counterclockwise: your branch with upstream!
Expand Down
32 changes: 32 additions & 0 deletions .github/workflows/label-signing.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Check Signed PR
on:
pull_request:
branches:
- 'develop'
- '4.*'

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

permissions:
contents: read
pull-requests: write

jobs:
build:
name: Check Signed Commit
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Check signed commits in PR
uses: 1Password/check-signed-commits-action@v1
with:
comment: |
You must GPG-sign your work, certifying that you either wrote the work or otherwise have the right to pass it on to an open-source project. See Developer's Certificate of Origin. See [signing][1].
**Note that all your commits must be signed.** If you have an unsigned commit, you can sign the previous commits by referring to [gpg-signing-old-commits][2].
[1]: https://github.com/codeigniter4/CodeIgniter4/blob/develop/contributing/pull_request.md#signing
[2]: https://github.com/codeigniter4/CodeIgniter4/blob/develop/contributing/workflow.md#gpg-signing-old-commits
1 change: 1 addition & 0 deletions admin/framework/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ writable/uploads/*
!writable/uploads/index.html

writable/debugbar/*
!writable/debugbar/.gitkeep

php_errors.log

Expand Down
1 change: 1 addition & 0 deletions admin/starter/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ writable/uploads/*
!writable/uploads/index.html

writable/debugbar/*
!writable/debugbar/.gitkeep

php_errors.log

Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"phpunit/phpcov": "^8.2",
"phpunit/phpunit": "^9.1",
"predis/predis": "^1.1 || ^2.0",
"rector/rector": "0.18.2",
"rector/rector": "0.18.3",
"vimeo/psalm": "^5.0"
},
"suggest": {
Expand Down
2 changes: 1 addition & 1 deletion phpstan.neon.dist
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ parameters:
- app/Views/errors/cli/*
- app/Views/errors/html/*
- system/Commands/Generators/Views/*
- system/Config/Routes.php
- system/Debug/Toolbar/Views/toolbar.tpl.php
- system/Images/Handlers/GDHandler.php
- system/Test/Filters/CITestStreamFilter.php
Expand All @@ -35,5 +34,6 @@ parameters:
treatPhpDocTypesAsCertain: false
strictRules:
allRules: false
disallowedLooseComparison: true
disallowedConstructs: true
matchingInheritedMethodNames: true
12 changes: 1 addition & 11 deletions rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@
use Rector\Php70\Rector\FuncCall\RandomFunctionRector;
use Rector\Php71\Rector\FuncCall\CountOnNullRector;
use Rector\Php73\Rector\FuncCall\JsonThrowOnErrorRector;
use Rector\Php73\Rector\FuncCall\StringifyStrNeedlesRector;
use Rector\PHPUnit\CodeQuality\Rector\Class_\ConstructClassMethodToSetUpTestCaseRector;
use Rector\PHPUnit\CodeQuality\Rector\Class_\YieldDataProviderRector;
use Rector\PHPUnit\Set\PHPUnitSetList;
use Rector\Privatization\Rector\Property\PrivatizeFinalClassPropertyRector;
Expand All @@ -57,7 +55,7 @@
PHPUnitSetList::PHPUNIT_100,
]);

$rectorConfig->parallel(240, 8, 1);
$rectorConfig->parallel();

// paths to refactor; solid alternative to CLI arguments
$rectorConfig->paths([__DIR__ . '/app', __DIR__ . '/system', __DIR__ . '/tests', __DIR__ . '/utils']);
Expand All @@ -81,21 +79,13 @@
__DIR__ . '/tests/system/Filters/fixtures',
__DIR__ . '/tests/_support',
JsonThrowOnErrorRector::class,
StringifyStrNeedlesRector::class,
YieldDataProviderRector::class,

RemoveUnusedPrivateMethodRector::class => [
// private method called via getPrivateMethodInvoker
__DIR__ . '/tests/system/Test/ReflectionHelperTest.php',
],

ConstructClassMethodToSetUpTestCaseRector::class => [
// breaks the constructor
__DIR__ . '/system/Test/TestResponse.php',
// See https://github.com/rectorphp/rector/issues/8188
__DIR__ . '/system/Test/ControllerResponse.php',
],

RemoveUnusedConstructorParamRector::class => [
// there are deprecated parameters
__DIR__ . '/system/Debug/Exceptions.php',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ final class ControllerMethodReader
*/
private string $namespace;

/**
* @var array<int, string>
* @phpstan-var list<string>
*/
private array $httpMethods;

/**
Expand Down
3 changes: 2 additions & 1 deletion system/Email/Email.php
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,8 @@ class Email
* Character sets valid for 7-bit encoding,
* excluding language suffix.
*
* @var array
* @var array<int, string>
* @phpstan-var list<string>
*/
protected $baseCharsets = [
'us-ascii',
Expand Down
26 changes: 20 additions & 6 deletions system/Router/RouteCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -1274,9 +1274,16 @@ protected function fillRouteParams(string $from, ?array $params = null): string
return '/' . ltrim($from, '/');
}

// Build our resulting string, inserting the $params in
// the appropriate places.
foreach ($matches[0] as $index => $pattern) {
/**
* Build our resulting string, inserting the $params in
* the appropriate places.
*
* @var array<int, string> $patterns
* @phpstan-var list<string> $patterns
*/
$patterns = $matches[0];

foreach ($patterns as $index => $pattern) {
if (! preg_match('#^' . $pattern . '$#u', $params[$index])) {
throw RouterException::forInvalidParameterType();
}
Expand Down Expand Up @@ -1319,9 +1326,16 @@ protected function buildReverseRoute(string $from, array $params): string
$locale = $params[$placeholderCount];
}

// Build our resulting string, inserting the $params in
// the appropriate places.
foreach ($matches[0] as $index => $placeholder) {
/**
* Build our resulting string, inserting the $params in
* the appropriate places.
*
* @var array<int, string> $placeholders
* @phpstan-var list<string> $placeholders
*/
$placeholders = $matches[0];

foreach ($placeholders as $index => $placeholder) {
if (! isset($params[$index])) {
throw new InvalidArgumentException(
'Missing argument for "' . $placeholder . '" in route "' . $from . '".'
Expand Down
2 changes: 2 additions & 0 deletions user_guide_src/source/installation/upgrade_validations.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ What has been changed
Use :ref:`Rule Classes <validation-using-rule-classes>` or
:ref:`Closure Rule <validation-using-closure-rule>`
instead.
- In CI3, Callbacks/Callable rules were prioritized, but in CI4, Closure Rules are
not prioritized, and are checked in the order in which they are listed.
- CI4 validation format rules do not permit empty string.
- CI4 validation never changes your data.
- Since v4.3.0, :php:func:`validation_errors()` has been introduced, but the API is different from CI3's.
Expand Down

0 comments on commit 2daf762

Please sign in to comment.