Skip to content

Commit 265ed2f

Browse files
authored
Merge pull request #6495 from codeigniter4/develop
4.2.6 Ready code
2 parents d51d4e9 + d1a9d04 commit 265ed2f

File tree

107 files changed

+938
-831
lines changed

Some content is hidden

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

107 files changed

+938
-831
lines changed

.php-cs-fixer.dist.php

Lines changed: 38 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
use CodeIgniter\CodingStandard\CodeIgniter4;
1515
use Nexus\CsConfig\Factory;
1616
use Nexus\CsConfig\Fixer\Comment\NoCodeSeparatorCommentFixer;
17-
use Nexus\CsConfig\Fixer\Comment\SpaceAfterCommentStartFixer;
1817
use Nexus\CsConfig\FixerGenerator;
1918
use PhpCsFixer\Finder;
2019

@@ -39,15 +38,51 @@
3938
__DIR__ . '/spark',
4039
]);
4140

42-
$overrides = [];
41+
$overrides = [
42+
// <<<<<<<<<<<<<<<<<<<<<<<< @TODO TO BE REMOVED ONCE LIVE IN CODING-STANDARD
43+
'blank_line_between_import_groups' => true,
44+
'class_definition' => [
45+
'multi_line_extends_each_single_line' => true,
46+
'single_item_single_line' => true,
47+
'single_line' => true,
48+
'space_before_parenthesis' => true,
49+
'inline_constructor_arguments' => true,
50+
],
51+
'control_structure_braces' => true,
52+
'no_multiple_statements_per_line' => true,
53+
'no_trailing_comma_in_singleline' => [
54+
'elements' => [
55+
'arguments',
56+
'array_destructuring',
57+
'array',
58+
'group_import',
59+
],
60+
],
61+
'no_useless_nullsafe_operator' => true,
62+
'phpdoc_separation' => [
63+
'groups' => [
64+
['immutable', 'psalm-immutable'],
65+
['param', 'phpstan-param', 'psalm-param'],
66+
['phpstan-pure', 'psalm-pure'],
67+
['readonly', 'psalm-readonly'],
68+
['return', 'phpstan-return', 'psalm-return'],
69+
['template', 'phpstan-template', 'psalm-template'],
70+
['template-covariant', 'phpstan-template-covariant', 'psalm-template-covariant'],
71+
['phpstan-type', 'psalm-type'],
72+
['var', 'phpstan-var', 'psalm-var'],
73+
],
74+
],
75+
'single_line_comment_spacing' => true,
76+
'statement_indentation' => true,
77+
// >>>>>>>>>>>>>>>>>>>>>>>>>
78+
];
4379

4480
$options = [
4581
'cacheFile' => 'build/.php-cs-fixer.cache',
4682
'finder' => $finder,
4783
'customFixers' => FixerGenerator::create('vendor/nexusphp/cs-config/src/Fixer', 'Nexus\\CsConfig\\Fixer'),
4884
'customRules' => [
4985
NoCodeSeparatorCommentFixer::name() => true,
50-
SpaceAfterCommentStartFixer::name() => true,
5186
],
5287
];
5388

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

Lines changed: 38 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
use CodeIgniter\CodingStandard\CodeIgniter4;
1515
use Nexus\CsConfig\Factory;
1616
use Nexus\CsConfig\Fixer\Comment\NoCodeSeparatorCommentFixer;
17-
use Nexus\CsConfig\Fixer\Comment\SpaceAfterCommentStartFixer;
1817
use Nexus\CsConfig\FixerGenerator;
1918
use PhpCsFixer\Finder;
2019

@@ -31,15 +30,51 @@
3130
__DIR__ . '/admin/starter/builds',
3231
]);
3332

34-
$overrides = [];
33+
$overrides = [
34+
// <<<<<<<<<<<<<<<<<<<<<<<< @TODO TO BE REMOVED ONCE LIVE IN CODING-STANDARD
35+
'blank_line_between_import_groups' => true,
36+
'class_definition' => [
37+
'multi_line_extends_each_single_line' => true,
38+
'single_item_single_line' => true,
39+
'single_line' => true,
40+
'space_before_parenthesis' => true,
41+
'inline_constructor_arguments' => true,
42+
],
43+
'control_structure_braces' => true,
44+
'no_multiple_statements_per_line' => true,
45+
'no_trailing_comma_in_singleline' => [
46+
'elements' => [
47+
'arguments',
48+
'array_destructuring',
49+
'array',
50+
'group_import',
51+
],
52+
],
53+
'no_useless_nullsafe_operator' => true,
54+
'phpdoc_separation' => [
55+
'groups' => [
56+
['immutable', 'psalm-immutable'],
57+
['param', 'phpstan-param', 'psalm-param'],
58+
['phpstan-pure', 'psalm-pure'],
59+
['readonly', 'psalm-readonly'],
60+
['return', 'phpstan-return', 'psalm-return'],
61+
['template', 'phpstan-template', 'psalm-template'],
62+
['template-covariant', 'phpstan-template-covariant', 'psalm-template-covariant'],
63+
['phpstan-type', 'psalm-type'],
64+
['var', 'phpstan-var', 'psalm-var'],
65+
],
66+
],
67+
'single_line_comment_spacing' => true,
68+
'statement_indentation' => true,
69+
// >>>>>>>>>>>>>>>>>>>>>>>>>
70+
];
3571

3672
$options = [
3773
'cacheFile' => 'build/.php-cs-fixer.no-header.cache',
3874
'finder' => $finder,
3975
'customFixers' => FixerGenerator::create('vendor/nexusphp/cs-config/src/Fixer', 'Nexus\\CsConfig\\Fixer'),
4076
'customRules' => [
4177
NoCodeSeparatorCommentFixer::name() => true,
42-
SpaceAfterCommentStartFixer::name() => true,
4378
],
4479
];
4580

.php-cs-fixer.user-guide.php

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
use CodeIgniter\CodingStandard\CodeIgniter4;
1515
use Nexus\CsConfig\Factory;
1616
use Nexus\CsConfig\Fixer\Comment\NoCodeSeparatorCommentFixer;
17-
use Nexus\CsConfig\Fixer\Comment\SpaceAfterCommentStartFixer;
1817
use Nexus\CsConfig\FixerGenerator;
1918
use PhpCsFixer\Finder;
2019

@@ -34,6 +33,42 @@
3433
'php_unit_internal_class' => false,
3534
'no_unused_imports' => false,
3635
'class_attributes_separation' => false,
36+
// <<<<<<<<<<<<<<<<<<<<<<<< @TODO TO BE REMOVED ONCE LIVE IN CODING-STANDARD
37+
'blank_line_between_import_groups' => true,
38+
'class_definition' => [
39+
'multi_line_extends_each_single_line' => true,
40+
'single_item_single_line' => true,
41+
'single_line' => true,
42+
'space_before_parenthesis' => true,
43+
'inline_constructor_arguments' => true,
44+
],
45+
'control_structure_braces' => true,
46+
'no_multiple_statements_per_line' => true,
47+
'no_trailing_comma_in_singleline' => [
48+
'elements' => [
49+
'arguments',
50+
'array_destructuring',
51+
'array',
52+
'group_import',
53+
],
54+
],
55+
'no_useless_nullsafe_operator' => true,
56+
'phpdoc_separation' => [
57+
'groups' => [
58+
['immutable', 'psalm-immutable'],
59+
['param', 'phpstan-param', 'psalm-param'],
60+
['phpstan-pure', 'psalm-pure'],
61+
['readonly', 'psalm-readonly'],
62+
['return', 'phpstan-return', 'psalm-return'],
63+
['template', 'phpstan-template', 'psalm-template'],
64+
['template-covariant', 'phpstan-template-covariant', 'psalm-template-covariant'],
65+
['phpstan-type', 'psalm-type'],
66+
['var', 'phpstan-var', 'psalm-var'],
67+
],
68+
],
69+
'single_line_comment_spacing' => true,
70+
'statement_indentation' => true,
71+
// >>>>>>>>>>>>>>>>>>>>>>>>>
3772
];
3873

3974
$options = [
@@ -42,7 +77,6 @@
4277
'customFixers' => FixerGenerator::create('vendor/nexusphp/cs-config/src/Fixer', 'Nexus\\CsConfig\\Fixer'),
4378
'customRules' => [
4479
NoCodeSeparatorCommentFixer::name() => true,
45-
SpaceAfterCommentStartFixer::name() => true,
4680
],
4781
];
4882

CHANGELOG.md

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

3+
## [v4.2.6](https://github.com/codeigniter4/CodeIgniter4/tree/v4.2.6) (2022-09-04)
4+
[Full Changelog](https://github.com/codeigniter4/CodeIgniter4/compare/v4.2.5...v4.2.6)
5+
6+
### Fixed Bugs
7+
* fix: AssertionError occurs when using Validation in CLI by @daycry in https://github.com/codeigniter4/CodeIgniter4/pull/6452
8+
* fix: [Validation] JSON data may cause "Array to string conversion" error by @kenjis in https://github.com/codeigniter4/CodeIgniter4/pull/6467
9+
* Fix fatal error gets turned to `0` severity on shutdown handler by @paulbalandan in https://github.com/codeigniter4/CodeIgniter4/pull/6472
10+
* Fix redis cache increment/decrement methods by @paulbalandan in https://github.com/codeigniter4/CodeIgniter4/pull/6473
11+
* Fix broken caching system when array of allowed parameters used by @JavaDeveloperKiev in https://github.com/codeigniter4/CodeIgniter4/pull/6475
12+
* fix: Strict Validation Rules greater_than/less_than by @kenjis in https://github.com/codeigniter4/CodeIgniter4/pull/6492
13+
14+
### Refactoring
15+
* refactor: fix PHPStan errors by @kenjis in https://github.com/codeigniter4/CodeIgniter4/pull/6470
16+
* Bump `friendsofphp/php-cs-fixer` to `~3.11.0` by @paulbalandan in https://github.com/codeigniter4/CodeIgniter4/pull/6471
17+
* Fix overlooked coding style violations by @paulbalandan in https://github.com/codeigniter4/CodeIgniter4/pull/6491
18+
319
## [v4.2.5](https://github.com/codeigniter4/CodeIgniter4/tree/v4.2.5) (2022-08-28)
420
[Full Changelog](https://github.com/codeigniter4/CodeIgniter4/compare/v4.2.4...v4.2.5)
521

admin/framework/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"require-dev": {
1818
"codeigniter/coding-standard": "^1.1",
1919
"fakerphp/faker": "^1.9",
20-
"friendsofphp/php-cs-fixer": "3.6.*",
20+
"friendsofphp/php-cs-fixer": "~3.11.0",
2121
"mikey179/vfsstream": "^1.6",
2222
"nexusphp/cs-config": "^3.3",
2323
"phpunit/phpunit": "^9.1",

app/Config/App.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -437,6 +437,7 @@ class App extends BaseConfig
437437
* Defaults to `Lax` as recommended in this link:
438438
*
439439
* @see https://portswigger.net/web-security/csrf/samesite-cookies
440+
*
440441
* @deprecated `Config\Cookie` $samesite property is used.
441442
*
442443
* @var string

app/Config/ContentSecurityPolicy.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@
1515
*/
1616
class ContentSecurityPolicy extends BaseConfig
1717
{
18-
//-------------------------------------------------------------------------
18+
// -------------------------------------------------------------------------
1919
// Broadbrush CSP management
20-
//-------------------------------------------------------------------------
20+
// -------------------------------------------------------------------------
2121

2222
/**
2323
* Default CSP report context
@@ -43,10 +43,10 @@ class ContentSecurityPolicy extends BaseConfig
4343
*/
4444
public $upgradeInsecureRequests = false;
4545

46-
//-------------------------------------------------------------------------
46+
// -------------------------------------------------------------------------
4747
// Sources allowed
4848
// Note: once you set a policy to 'none', it cannot be further restricted
49-
//-------------------------------------------------------------------------
49+
// -------------------------------------------------------------------------
5050

5151
/**
5252
* Will default to self if not overridden

app/Config/Routes.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
// where controller filters or CSRF protection are bypassed.
2626
// If you don't want to define all routes, please use the Auto Routing (Improved).
2727
// Set `$autoRoutesImproved` to true in `app/Config/Feature.php` and set the following to true.
28-
//$routes->setAutoRoute(false);
28+
// $routes->setAutoRoute(false);
2929

3030
/*
3131
* --------------------------------------------------------------------

app/Config/Validation.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@
1010

1111
class Validation extends BaseConfig
1212
{
13-
//--------------------------------------------------------------------
13+
// --------------------------------------------------------------------
1414
// Setup
15-
//--------------------------------------------------------------------
15+
// --------------------------------------------------------------------
1616

1717
/**
1818
* Stores the classes that contain the
@@ -38,7 +38,7 @@ class Validation extends BaseConfig
3838
'single' => 'CodeIgniter\Validation\Views\single',
3939
];
4040

41-
//--------------------------------------------------------------------
41+
// --------------------------------------------------------------------
4242
// Rules
43-
//--------------------------------------------------------------------
43+
// --------------------------------------------------------------------
4444
}

composer.json

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,14 @@
1717
"require-dev": {
1818
"codeigniter/coding-standard": "^1.1",
1919
"fakerphp/faker": "^1.9",
20-
"friendsofphp/php-cs-fixer": "3.6.*",
20+
"friendsofphp/php-cs-fixer": "~3.11.0",
2121
"mikey179/vfsstream": "^1.6",
2222
"nexusphp/cs-config": "^3.3",
2323
"nexusphp/tachycardia": "^1.0",
2424
"phpstan/phpstan": "^1.7.1",
2525
"phpunit/phpunit": "^9.1",
2626
"predis/predis": "^1.1 || ^2.0",
27-
"rector/rector": "0.14.0"
27+
"rector/rector": "0.14.1"
2828
},
2929
"suggest": {
3030
"ext-imagick": "If you use Image class ImageMagickHandler",
@@ -70,7 +70,11 @@
7070
"CodeIgniter\\ComposerScripts::postUpdate",
7171
"bash -c \"if [ -f admin/setup.sh ]; then bash admin/setup.sh; fi\""
7272
],
73-
"analyze": "phpstan analyse",
73+
"analyze": [
74+
"phpstan analyze",
75+
"rector process --dry-run"
76+
],
77+
"sa": "@analyze",
7478
"test": "phpunit",
7579
"cs": [
7680
"php-cs-fixer fix --ansi --verbose --dry-run --diff --config=.php-cs-fixer.user-guide.php",
@@ -81,7 +85,8 @@
8185
"php-cs-fixer fix --ansi --verbose --diff --config=.php-cs-fixer.user-guide.php",
8286
"php-cs-fixer fix --ansi --verbose --diff --config=.php-cs-fixer.no-header.php",
8387
"php-cs-fixer fix --ansi --verbose --diff"
84-
]
88+
],
89+
"style": "@cs-fix"
8590
},
8691
"scripts-descriptions": {
8792
"analyze": "Run static analysis",

contributing/pull_request.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,6 @@ The best way to contribute is to fork the CodeIgniter4 repository, and "clone" t
252252
- 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.
253253
9. If you have touched PHP code, run static analysis.
254254
- `> composer analyze`
255-
- `> vendor/bin/rector process`
256255
10. Run unit tests on the specific file you modified. If there are no existing tests yet, please create one.
257256
- `> vendor/bin/phpunit tests/system/path/to/file/you/modified`
258257
- Make sure the tests pass to have a higher chance of merging.

contributing/workflow.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ Clone your repository, leaving a local folder for you to work with:
6666
> git clone ORIGIN_URL
6767
```
6868

69-
## Syncing your repository
69+
## Syncing Your Repository
7070

7171
Within your local repository, Git will have created an alias,
7272
**origin**, for the GitHub repository it is bound to. You want to create
@@ -179,7 +179,11 @@ For instance, to commit your work from a debugging session:
179179

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

182-
### When you work on two features
182+
### Changing a Commit Message
183+
184+
See <https://docs.github.com/en/pull-requests/committing-changes-to-your-project/creating-and-editing-commits/changing-a-commit-message>.
185+
186+
### When You Work on Two Features
183187

184188
If you are working on two features at a time, then you will want to
185189
switch between them to keep the contributions separate. For instance:
@@ -314,7 +318,7 @@ And finally push your local branch to your GitHub repository:
314318
> git push --force-with-lease origin fix/problem123
315319
```
316320

317-
## If you sent to the wrong branch
321+
## If You Sent to the Wrong Branch
318322

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

phpstan-baseline.neon.dist

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -55,16 +55,6 @@ parameters:
5555
count: 1
5656
path: system/Cache/Handlers/FileHandler.php
5757

58-
-
59-
message: "#^Method MemcachePool\\:\\:decrement\\(\\) invoked with 4 parameters, 1\\-2 required\\.$#"
60-
count: 1
61-
path: system/Cache/Handlers/MemcachedHandler.php
62-
63-
-
64-
message: "#^Method MemcachePool\\:\\:increment\\(\\) invoked with 4 parameters, 1\\-2 required\\.$#"
65-
count: 1
66-
path: system/Cache/Handlers/MemcachedHandler.php
67-
6858
-
6959
message: "#^Unreachable statement \\- code above always terminates\\.$#"
7060
count: 1
@@ -545,11 +535,6 @@ parameters:
545535
count: 1
546536
path: system/HTTP/Request.php
547537

548-
-
549-
message: "#^Cannot unset offset 'path' on array{host: non-empty-string}\\.$#"
550-
count: 1
551-
path: system/HTTP/URI.php
552-
553538
-
554539
message: "#^Property CodeIgniter\\\\HTTP\\\\URI\\:\\:\\$fragment \\(string\\) on left side of \\?\\? is not nullable\\.$#"
555540
count: 1
@@ -580,11 +565,6 @@ parameters:
580565
count: 1
581566
path: system/Helpers/number_helper.php
582567

583-
-
584-
message: "#^Variable \\$pool might not be defined\\.$#"
585-
count: 2
586-
path: system/Helpers/text_helper.php
587-
588568
-
589569
message: "#^Variable \\$count might not be defined\\.$#"
590570
count: 1

0 commit comments

Comments
 (0)