Skip to content

Commit

Permalink
Merge pull request codeigniter4#6495 from codeigniter4/develop
Browse files Browse the repository at this point in the history
4.2.6 Ready code
  • Loading branch information
MGatner authored Sep 4, 2022
2 parents d51d4e9 + d1a9d04 commit 265ed2f
Show file tree
Hide file tree
Showing 107 changed files with 938 additions and 831 deletions.
41 changes: 38 additions & 3 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
use CodeIgniter\CodingStandard\CodeIgniter4;
use Nexus\CsConfig\Factory;
use Nexus\CsConfig\Fixer\Comment\NoCodeSeparatorCommentFixer;
use Nexus\CsConfig\Fixer\Comment\SpaceAfterCommentStartFixer;
use Nexus\CsConfig\FixerGenerator;
use PhpCsFixer\Finder;

Expand All @@ -39,15 +38,51 @@
__DIR__ . '/spark',
]);

$overrides = [];
$overrides = [
// <<<<<<<<<<<<<<<<<<<<<<<< @TODO TO BE REMOVED ONCE LIVE IN CODING-STANDARD
'blank_line_between_import_groups' => true,
'class_definition' => [
'multi_line_extends_each_single_line' => true,
'single_item_single_line' => true,
'single_line' => true,
'space_before_parenthesis' => true,
'inline_constructor_arguments' => true,
],
'control_structure_braces' => true,
'no_multiple_statements_per_line' => true,
'no_trailing_comma_in_singleline' => [
'elements' => [
'arguments',
'array_destructuring',
'array',
'group_import',
],
],
'no_useless_nullsafe_operator' => true,
'phpdoc_separation' => [
'groups' => [
['immutable', 'psalm-immutable'],
['param', 'phpstan-param', 'psalm-param'],
['phpstan-pure', 'psalm-pure'],
['readonly', 'psalm-readonly'],
['return', 'phpstan-return', 'psalm-return'],
['template', 'phpstan-template', 'psalm-template'],
['template-covariant', 'phpstan-template-covariant', 'psalm-template-covariant'],
['phpstan-type', 'psalm-type'],
['var', 'phpstan-var', 'psalm-var'],
],
],
'single_line_comment_spacing' => true,
'statement_indentation' => true,
// >>>>>>>>>>>>>>>>>>>>>>>>>
];

$options = [
'cacheFile' => 'build/.php-cs-fixer.cache',
'finder' => $finder,
'customFixers' => FixerGenerator::create('vendor/nexusphp/cs-config/src/Fixer', 'Nexus\\CsConfig\\Fixer'),
'customRules' => [
NoCodeSeparatorCommentFixer::name() => true,
SpaceAfterCommentStartFixer::name() => true,
],
];

Expand Down
41 changes: 38 additions & 3 deletions .php-cs-fixer.no-header.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
use CodeIgniter\CodingStandard\CodeIgniter4;
use Nexus\CsConfig\Factory;
use Nexus\CsConfig\Fixer\Comment\NoCodeSeparatorCommentFixer;
use Nexus\CsConfig\Fixer\Comment\SpaceAfterCommentStartFixer;
use Nexus\CsConfig\FixerGenerator;
use PhpCsFixer\Finder;

Expand All @@ -31,15 +30,51 @@
__DIR__ . '/admin/starter/builds',
]);

$overrides = [];
$overrides = [
// <<<<<<<<<<<<<<<<<<<<<<<< @TODO TO BE REMOVED ONCE LIVE IN CODING-STANDARD
'blank_line_between_import_groups' => true,
'class_definition' => [
'multi_line_extends_each_single_line' => true,
'single_item_single_line' => true,
'single_line' => true,
'space_before_parenthesis' => true,
'inline_constructor_arguments' => true,
],
'control_structure_braces' => true,
'no_multiple_statements_per_line' => true,
'no_trailing_comma_in_singleline' => [
'elements' => [
'arguments',
'array_destructuring',
'array',
'group_import',
],
],
'no_useless_nullsafe_operator' => true,
'phpdoc_separation' => [
'groups' => [
['immutable', 'psalm-immutable'],
['param', 'phpstan-param', 'psalm-param'],
['phpstan-pure', 'psalm-pure'],
['readonly', 'psalm-readonly'],
['return', 'phpstan-return', 'psalm-return'],
['template', 'phpstan-template', 'psalm-template'],
['template-covariant', 'phpstan-template-covariant', 'psalm-template-covariant'],
['phpstan-type', 'psalm-type'],
['var', 'phpstan-var', 'psalm-var'],
],
],
'single_line_comment_spacing' => true,
'statement_indentation' => true,
// >>>>>>>>>>>>>>>>>>>>>>>>>
];

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

Expand Down
38 changes: 36 additions & 2 deletions .php-cs-fixer.user-guide.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
use CodeIgniter\CodingStandard\CodeIgniter4;
use Nexus\CsConfig\Factory;
use Nexus\CsConfig\Fixer\Comment\NoCodeSeparatorCommentFixer;
use Nexus\CsConfig\Fixer\Comment\SpaceAfterCommentStartFixer;
use Nexus\CsConfig\FixerGenerator;
use PhpCsFixer\Finder;

Expand All @@ -34,6 +33,42 @@
'php_unit_internal_class' => false,
'no_unused_imports' => false,
'class_attributes_separation' => false,
// <<<<<<<<<<<<<<<<<<<<<<<< @TODO TO BE REMOVED ONCE LIVE IN CODING-STANDARD
'blank_line_between_import_groups' => true,
'class_definition' => [
'multi_line_extends_each_single_line' => true,
'single_item_single_line' => true,
'single_line' => true,
'space_before_parenthesis' => true,
'inline_constructor_arguments' => true,
],
'control_structure_braces' => true,
'no_multiple_statements_per_line' => true,
'no_trailing_comma_in_singleline' => [
'elements' => [
'arguments',
'array_destructuring',
'array',
'group_import',
],
],
'no_useless_nullsafe_operator' => true,
'phpdoc_separation' => [
'groups' => [
['immutable', 'psalm-immutable'],
['param', 'phpstan-param', 'psalm-param'],
['phpstan-pure', 'psalm-pure'],
['readonly', 'psalm-readonly'],
['return', 'phpstan-return', 'psalm-return'],
['template', 'phpstan-template', 'psalm-template'],
['template-covariant', 'phpstan-template-covariant', 'psalm-template-covariant'],
['phpstan-type', 'psalm-type'],
['var', 'phpstan-var', 'psalm-var'],
],
],
'single_line_comment_spacing' => true,
'statement_indentation' => true,
// >>>>>>>>>>>>>>>>>>>>>>>>>
];

$options = [
Expand All @@ -42,7 +77,6 @@
'customFixers' => FixerGenerator::create('vendor/nexusphp/cs-config/src/Fixer', 'Nexus\\CsConfig\\Fixer'),
'customRules' => [
NoCodeSeparatorCommentFixer::name() => true,
SpaceAfterCommentStartFixer::name() => true,
],
];

Expand Down
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
# Changelog

## [v4.2.6](https://github.com/codeigniter4/CodeIgniter4/tree/v4.2.6) (2022-09-04)
[Full Changelog](https://github.com/codeigniter4/CodeIgniter4/compare/v4.2.5...v4.2.6)

### Fixed Bugs
* fix: AssertionError occurs when using Validation in CLI by @daycry in https://github.com/codeigniter4/CodeIgniter4/pull/6452
* fix: [Validation] JSON data may cause "Array to string conversion" error by @kenjis in https://github.com/codeigniter4/CodeIgniter4/pull/6467
* Fix fatal error gets turned to `0` severity on shutdown handler by @paulbalandan in https://github.com/codeigniter4/CodeIgniter4/pull/6472
* Fix redis cache increment/decrement methods by @paulbalandan in https://github.com/codeigniter4/CodeIgniter4/pull/6473
* Fix broken caching system when array of allowed parameters used by @JavaDeveloperKiev in https://github.com/codeigniter4/CodeIgniter4/pull/6475
* fix: Strict Validation Rules greater_than/less_than by @kenjis in https://github.com/codeigniter4/CodeIgniter4/pull/6492

### Refactoring
* refactor: fix PHPStan errors by @kenjis in https://github.com/codeigniter4/CodeIgniter4/pull/6470
* Bump `friendsofphp/php-cs-fixer` to `~3.11.0` by @paulbalandan in https://github.com/codeigniter4/CodeIgniter4/pull/6471
* Fix overlooked coding style violations by @paulbalandan in https://github.com/codeigniter4/CodeIgniter4/pull/6491

## [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)

Expand Down
2 changes: 1 addition & 1 deletion admin/framework/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"require-dev": {
"codeigniter/coding-standard": "^1.1",
"fakerphp/faker": "^1.9",
"friendsofphp/php-cs-fixer": "3.6.*",
"friendsofphp/php-cs-fixer": "~3.11.0",
"mikey179/vfsstream": "^1.6",
"nexusphp/cs-config": "^3.3",
"phpunit/phpunit": "^9.1",
Expand Down
1 change: 1 addition & 0 deletions app/Config/App.php
Original file line number Diff line number Diff line change
Expand Up @@ -437,6 +437,7 @@ class App extends BaseConfig
* Defaults to `Lax` as recommended in this link:
*
* @see https://portswigger.net/web-security/csrf/samesite-cookies
*
* @deprecated `Config\Cookie` $samesite property is used.
*
* @var string
Expand Down
8 changes: 4 additions & 4 deletions app/Config/ContentSecurityPolicy.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
*/
class ContentSecurityPolicy extends BaseConfig
{
//-------------------------------------------------------------------------
// -------------------------------------------------------------------------
// Broadbrush CSP management
//-------------------------------------------------------------------------
// -------------------------------------------------------------------------

/**
* Default CSP report context
Expand All @@ -43,10 +43,10 @@ class ContentSecurityPolicy extends BaseConfig
*/
public $upgradeInsecureRequests = false;

//-------------------------------------------------------------------------
// -------------------------------------------------------------------------
// Sources allowed
// Note: once you set a policy to 'none', it cannot be further restricted
//-------------------------------------------------------------------------
// -------------------------------------------------------------------------

/**
* Will default to self if not overridden
Expand Down
2 changes: 1 addition & 1 deletion app/Config/Routes.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
// where controller filters or CSRF protection are bypassed.
// If you don't want to define all routes, please use the Auto Routing (Improved).
// Set `$autoRoutesImproved` to true in `app/Config/Feature.php` and set the following to true.
//$routes->setAutoRoute(false);
// $routes->setAutoRoute(false);

/*
* --------------------------------------------------------------------
Expand Down
8 changes: 4 additions & 4 deletions app/Config/Validation.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@

class Validation extends BaseConfig
{
//--------------------------------------------------------------------
// --------------------------------------------------------------------
// Setup
//--------------------------------------------------------------------
// --------------------------------------------------------------------

/**
* Stores the classes that contain the
Expand All @@ -38,7 +38,7 @@ class Validation extends BaseConfig
'single' => 'CodeIgniter\Validation\Views\single',
];

//--------------------------------------------------------------------
// --------------------------------------------------------------------
// Rules
//--------------------------------------------------------------------
// --------------------------------------------------------------------
}
13 changes: 9 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@
"require-dev": {
"codeigniter/coding-standard": "^1.1",
"fakerphp/faker": "^1.9",
"friendsofphp/php-cs-fixer": "3.6.*",
"friendsofphp/php-cs-fixer": "~3.11.0",
"mikey179/vfsstream": "^1.6",
"nexusphp/cs-config": "^3.3",
"nexusphp/tachycardia": "^1.0",
"phpstan/phpstan": "^1.7.1",
"phpunit/phpunit": "^9.1",
"predis/predis": "^1.1 || ^2.0",
"rector/rector": "0.14.0"
"rector/rector": "0.14.1"
},
"suggest": {
"ext-imagick": "If you use Image class ImageMagickHandler",
Expand Down Expand Up @@ -70,7 +70,11 @@
"CodeIgniter\\ComposerScripts::postUpdate",
"bash -c \"if [ -f admin/setup.sh ]; then bash admin/setup.sh; fi\""
],
"analyze": "phpstan analyse",
"analyze": [
"phpstan analyze",
"rector process --dry-run"
],
"sa": "@analyze",
"test": "phpunit",
"cs": [
"php-cs-fixer fix --ansi --verbose --dry-run --diff --config=.php-cs-fixer.user-guide.php",
Expand All @@ -81,7 +85,8 @@
"php-cs-fixer fix --ansi --verbose --diff --config=.php-cs-fixer.user-guide.php",
"php-cs-fixer fix --ansi --verbose --diff --config=.php-cs-fixer.no-header.php",
"php-cs-fixer fix --ansi --verbose --diff"
]
],
"style": "@cs-fix"
},
"scripts-descriptions": {
"analyze": "Run static analysis",
Expand Down
1 change: 0 additions & 1 deletion contributing/pull_request.md
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,6 @@ The best way to contribute is to fork the CodeIgniter4 repository, and "clone" t
- 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`
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.
Expand Down
10 changes: 7 additions & 3 deletions contributing/workflow.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ Clone your repository, leaving a local folder for you to work with:
> git clone ORIGIN_URL
```

## Syncing your repository
## Syncing Your Repository

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

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

### When you work on two features
### Changing a Commit Message

See <https://docs.github.com/en/pull-requests/committing-changes-to-your-project/creating-and-editing-commits/changing-a-commit-message>.

### 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 Down Expand Up @@ -314,7 +318,7 @@ 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 Sent to the Wrong Branch

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

Expand Down
20 changes: 0 additions & 20 deletions phpstan-baseline.neon.dist
Original file line number Diff line number Diff line change
Expand Up @@ -55,16 +55,6 @@ parameters:
count: 1
path: system/Cache/Handlers/FileHandler.php

-
message: "#^Method MemcachePool\\:\\:decrement\\(\\) invoked with 4 parameters, 1\\-2 required\\.$#"
count: 1
path: system/Cache/Handlers/MemcachedHandler.php

-
message: "#^Method MemcachePool\\:\\:increment\\(\\) invoked with 4 parameters, 1\\-2 required\\.$#"
count: 1
path: system/Cache/Handlers/MemcachedHandler.php

-
message: "#^Unreachable statement \\- code above always terminates\\.$#"
count: 1
Expand Down Expand Up @@ -545,11 +535,6 @@ parameters:
count: 1
path: system/HTTP/Request.php

-
message: "#^Cannot unset offset 'path' on array{host: non-empty-string}\\.$#"
count: 1
path: system/HTTP/URI.php

-
message: "#^Property CodeIgniter\\\\HTTP\\\\URI\\:\\:\\$fragment \\(string\\) on left side of \\?\\? is not nullable\\.$#"
count: 1
Expand Down Expand Up @@ -580,11 +565,6 @@ parameters:
count: 1
path: system/Helpers/number_helper.php

-
message: "#^Variable \\$pool might not be defined\\.$#"
count: 2
path: system/Helpers/text_helper.php

-
message: "#^Variable \\$count might not be defined\\.$#"
count: 1
Expand Down
Loading

0 comments on commit 265ed2f

Please sign in to comment.