diff --git a/tools/.phpstan/composer.json b/tools/.phpstan/composer.json index e9d3f7ff7..dc2da2bc7 100644 --- a/tools/.phpstan/composer.json +++ b/tools/.phpstan/composer.json @@ -1,9 +1,9 @@ { "require-dev": { - "phpstan/phpstan": "^2.3.3", + "phpstan/phpstan": "^2.3.4", "phpstan/extension-installer": "^1.4.3", "phpstan/phpstan-strict-rules": "^2.1.0", - "ergebnis/phpstan-rules": "^2.14.2" + "ergebnis/phpstan-rules": "^2.16.0" }, "config": { "allow-plugins": { diff --git a/tools/.phpstan/composer.lock b/tools/.phpstan/composer.lock index f731b4652..f3ec1b37a 100644 --- a/tools/.phpstan/composer.lock +++ b/tools/.phpstan/composer.lock @@ -4,24 +4,25 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "ca46b60d0fdc0647a8d36e97a1812b18", + "content-hash": "c75d3090b60f562b95a50b8015d97365", "packages": [], "packages-dev": [ { "name": "ergebnis/phpstan-rules", - "version": "2.14.2", + "version": "2.16.0", "source": { "type": "git", "url": "https://github.com/ergebnis/phpstan-rules.git", - "reference": "a8d8695a4197b79f74e1ed1353ef52c41578c0ab" + "reference": "e123a05ffb337670f9f65fff3c3f25517d3d888e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/ergebnis/phpstan-rules/zipball/a8d8695a4197b79f74e1ed1353ef52c41578c0ab", - "reference": "a8d8695a4197b79f74e1ed1353ef52c41578c0ab", + "url": "https://api.github.com/repos/ergebnis/phpstan-rules/zipball/e123a05ffb337670f9f65fff3c3f25517d3d888e", + "reference": "e123a05ffb337670f9f65fff3c3f25517d3d888e", "shasum": "" }, "require": { + "composer-runtime-api": "^2.0.0", "ext-mbstring": "*", "php": "~7.4.0 || ~8.0.0 || ~8.1.0 || ~8.2.0 || ~8.3.0 || ~8.4.0 || ~8.5.0 || ~8.6.0", "phpstan/phpstan": "^2.1.35" @@ -37,11 +38,11 @@ "fakerphp/faker": "^1.24.1", "phpstan/extension-installer": "^1.4.3", "phpstan/phpstan-deprecation-rules": "^2.0.5", - "phpstan/phpstan-phpunit": "^2.0.21", + "phpstan/phpstan-phpunit": "^2.1.1", "phpstan/phpstan-strict-rules": "^2.1.0", "phpunit/phpunit": "^9.6.33", "psr/container": "^2.0.2", - "rector/rector": "^2.3.8", + "rector/rector": "^2.7.0", "symfony/finder": "^5.4.45", "symfony/process": "^5.4.51" }, @@ -53,7 +54,7 @@ ] }, "branch-alias": { - "dev-main": "2.14-dev" + "dev-main": "2.16-dev" } }, "autoload": { @@ -83,7 +84,7 @@ "security": "https://github.com/ergebnis/phpstan-rules/blob/main/.github/SECURITY.md", "source": "https://github.com/ergebnis/phpstan-rules" }, - "time": "2026-10-16T14:36:23+00:00" + "time": "2026-10-28T23:53:24+00:00" }, { "name": "phpstan/extension-installer", @@ -135,11 +136,11 @@ }, { "name": "phpstan/phpstan", - "version": "2.3.3", + "version": "2.3.4", "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/4b57dc8ca7456b635d1661845f44bc060b02c6b0", - "reference": "4b57dc8ca7456b635d1661845f44bc060b02c6b0", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/f20ce6f3c82556cfcfc086b152445a12d1d64fff", + "reference": "f20ce6f3c82556cfcfc086b152445a12d1d64fff", "shasum": "" }, "require": { @@ -195,7 +196,7 @@ "type": "github" } ], - "time": "2026-10-27T14:06:26+00:00" + "time": "2026-10-28T22:38:53+00:00" }, { "name": "phpstan/phpstan-strict-rules", diff --git a/tools/.phpstan/vendor/composer/installed.json b/tools/.phpstan/vendor/composer/installed.json index 3d3597bb3..6c0bf9428 100644 --- a/tools/.phpstan/vendor/composer/installed.json +++ b/tools/.phpstan/vendor/composer/installed.json @@ -2,20 +2,21 @@ "packages": [ { "name": "ergebnis/phpstan-rules", - "version": "2.14.2", - "version_normalized": "2.14.2.0", + "version": "2.16.0", + "version_normalized": "2.16.0.0", "source": { "type": "git", "url": "https://github.com/ergebnis/phpstan-rules.git", - "reference": "a8d8695a4197b79f74e1ed1353ef52c41578c0ab" + "reference": "e123a05ffb337670f9f65fff3c3f25517d3d888e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/ergebnis/phpstan-rules/zipball/a8d8695a4197b79f74e1ed1353ef52c41578c0ab", - "reference": "a8d8695a4197b79f74e1ed1353ef52c41578c0ab", + "url": "https://api.github.com/repos/ergebnis/phpstan-rules/zipball/e123a05ffb337670f9f65fff3c3f25517d3d888e", + "reference": "e123a05ffb337670f9f65fff3c3f25517d3d888e", "shasum": "" }, "require": { + "composer-runtime-api": "^2.0.0", "ext-mbstring": "*", "php": "~7.4.0 || ~8.0.0 || ~8.1.0 || ~8.2.0 || ~8.3.0 || ~8.4.0 || ~8.5.0 || ~8.6.0", "phpstan/phpstan": "^2.1.35" @@ -31,15 +32,15 @@ "fakerphp/faker": "^1.24.1", "phpstan/extension-installer": "^1.4.3", "phpstan/phpstan-deprecation-rules": "^2.0.5", - "phpstan/phpstan-phpunit": "^2.0.21", + "phpstan/phpstan-phpunit": "^2.1.1", "phpstan/phpstan-strict-rules": "^2.1.0", "phpunit/phpunit": "^9.6.33", "psr/container": "^2.0.2", - "rector/rector": "^2.3.8", + "rector/rector": "^2.7.0", "symfony/finder": "^5.4.45", "symfony/process": "^5.4.51" }, - "time": "2026-10-16T14:36:23+00:00", + "time": "2026-10-28T23:53:24+00:00", "type": "phpstan-extension", "extra": { "phpstan": { @@ -48,7 +49,7 @@ ] }, "branch-alias": { - "dev-main": "2.14-dev" + "dev-main": "2.16-dev" } }, "installation-source": "dist", @@ -134,12 +135,12 @@ }, { "name": "phpstan/phpstan", - "version": "2.3.3", - "version_normalized": "2.3.3.0", + "version": "2.3.4", + "version_normalized": "2.3.4.0", "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/4b57dc8ca7456b635d1661845f44bc060b02c6b0", - "reference": "4b57dc8ca7456b635d1661845f44bc060b02c6b0", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/f20ce6f3c82556cfcfc086b152445a12d1d64fff", + "reference": "f20ce6f3c82556cfcfc086b152445a12d1d64fff", "shasum": "" }, "require": { @@ -148,7 +149,7 @@ "conflict": { "phpstan/phpstan-shim": "*" }, - "time": "2026-10-27T14:06:26+00:00", + "time": "2026-10-28T22:38:53+00:00", "bin": [ "phpstan", "phpstan.phar" diff --git a/tools/.phpstan/vendor/composer/installed.php b/tools/.phpstan/vendor/composer/installed.php index 4bd294c99..766d299a5 100644 --- a/tools/.phpstan/vendor/composer/installed.php +++ b/tools/.phpstan/vendor/composer/installed.php @@ -3,7 +3,7 @@ 'name' => '__root__', 'pretty_version' => '12.5.x-dev', 'version' => '12.5.9999999.9999999-dev', - 'reference' => 'b0c54e77d738d49ccbb6557237cbdcbbfe764aac', + 'reference' => '2cc8652737350890f4798ad243b4b02a6fa52ac0', 'type' => 'library', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), @@ -13,16 +13,16 @@ '__root__' => array( 'pretty_version' => '12.5.x-dev', 'version' => '12.5.9999999.9999999-dev', - 'reference' => 'b0c54e77d738d49ccbb6557237cbdcbbfe764aac', + 'reference' => '2cc8652737350890f4798ad243b4b02a6fa52ac0', 'type' => 'library', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), 'dev_requirement' => false, ), 'ergebnis/phpstan-rules' => array( - 'pretty_version' => '2.14.2', - 'version' => '2.14.2.0', - 'reference' => 'a8d8695a4197b79f74e1ed1353ef52c41578c0ab', + 'pretty_version' => '2.16.0', + 'version' => '2.16.0.0', + 'reference' => 'e123a05ffb337670f9f65fff3c3f25517d3d888e', 'type' => 'phpstan-extension', 'install_path' => __DIR__ . '/../ergebnis/phpstan-rules', 'aliases' => array(), @@ -38,9 +38,9 @@ 'dev_requirement' => true, ), 'phpstan/phpstan' => array( - 'pretty_version' => '2.3.3', - 'version' => '2.3.3.0', - 'reference' => '4b57dc8ca7456b635d1661845f44bc060b02c6b0', + 'pretty_version' => '2.3.4', + 'version' => '2.3.4.0', + 'reference' => 'f20ce6f3c82556cfcfc086b152445a12d1d64fff', 'type' => 'library', 'install_path' => __DIR__ . '/../phpstan/phpstan', 'aliases' => array(), diff --git a/tools/.phpstan/vendor/ergebnis/phpstan-rules/CHANGELOG.md b/tools/.phpstan/vendor/ergebnis/phpstan-rules/CHANGELOG.md index f37ec83e4..c32a0cfc9 100644 --- a/tools/.phpstan/vendor/ergebnis/phpstan-rules/CHANGELOG.md +++ b/tools/.phpstan/vendor/ergebnis/phpstan-rules/CHANGELOG.md @@ -6,7 +6,37 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), ## Unreleased -For a full diff see [`2.14.2...main`][2.14.2...main]. +For a full diff see [`2.16.0...main`][2.16.0...main]. + +## [`2.16.0`][2.16.0] + +For a full diff see [`2.15.0...2.16.0`][2.15.0...2.16.0]. + +### Added + +- Added `PropertyHooks\NoReturnByReferenceRule`, which reports an error when a property hook returns by reference ([#915]), by [@localheinz] +- Added `PropertyHooks\NoParameterWithNullableTypeDeclarationRule`, which reports an error when a property hook has a parameter with a nullable type declaration ([#1154]), by [@localheinz] +- Added documentation for every rule in `doc/rules/`, generated from the definitions of the rules ([#1156]), by [@localheinz] +- Added a rationale to the documentation of every rule and a tip with a link to the documentation to every error reported by a rule, which requires `composer-runtime-api:^2.0.0` ([#1158]), by [@localheinz] +- Added code samples to the documentation of every rule ([#1159]), by [@localheinz] +- Added an `ignoreDoctrineEntities` parameter to `Classes\FinalRule` and `Methods\FinalInAbstractClassRule`, which allow requiring Doctrine entities to be `final` when using native lazy objects ([#1162]), by [@localheinz] + +### Fixed + +- Adjusted `CallLikes\NoNamedArgumentRule` to report named arguments instead of causing an internal error when the invoked method cannot be resolved ([#959]), by [@localheinz] +- Adjusted the descriptions of rules for methods to match the descriptions of the corresponding rules for arrow functions, closures, and functions ([#1160]), by [@localheinz] +- Adjusted `Methods\FinalInAbstractClassRule` to no longer ignore Doctrine embeddables, which Doctrine does not extend ([#1163]), by [@localheinz] + +## [`2.15.0`][2.15.0] + +For a full diff see [`2.14.2...2.15.0`][2.14.2...2.15.0]. + +### Added + +- Added `ArrowFunctions\NoNullableReturnTypeDeclarationRule`, which reports an error when an arrow function has a nullable return type declaration ([#1146]), by [@localheinz] +- Added `ArrowFunctions\NoParameterWithNullableTypeDeclarationRule`, which reports an error when an arrow function has a parameter with a nullable type declaration ([#1149]), by [@localheinz] +- Added `ArrowFunctions\NoParameterWithNullDefaultValueRule`, which reports an error when an arrow function has a parameter with `null` as default value ([#1150]), by [@localheinz] +- Added `ArrowFunctions\NoParameterPassedByReferenceRule`, which reports an error when an arrow function has a parameter that is passed by reference ([#1151]), by [@localheinz] ## [`2.14.2`][2.14.2] @@ -696,7 +726,11 @@ For a full diff see [`362c7ea...0.1.0`][362c7ea...0.1.0]. [2.14.1]: https://github.com/ergebnis/phpstan-rules/releases/tag/2.14.1 [2.14.1...2.14.2]: https://github.com/ergebnis/phpstan-rules/compare/2.14.1...2.14.2 [2.14.2]: https://github.com/ergebnis/phpstan-rules/releases/tag/2.14.2 -[2.14.2...main]: https://github.com/ergebnis/phpstan-rules/compare/2.14.2...main +[2.14.2...2.15.0]: https://github.com/ergebnis/phpstan-rules/compare/2.14.2...2.15.0 +[2.15.0]: https://github.com/ergebnis/phpstan-rules/releases/tag/2.15.0 +[2.15.0...2.16.0]: https://github.com/ergebnis/phpstan-rules/compare/2.15.0...2.16.0 +[2.16.0]: https://github.com/ergebnis/phpstan-rules/releases/tag/2.16.0 +[2.16.0...main]: https://github.com/ergebnis/phpstan-rules/compare/2.16.0...main [#1]: https://github.com/ergebnis/phpstan-rules/pull/1 [#4]: https://github.com/ergebnis/phpstan-rules/pull/4 @@ -782,6 +816,7 @@ For a full diff see [`362c7ea...0.1.0`][362c7ea...0.1.0]. [#912]: https://github.com/ergebnis/phpstan-rules/pull/912 [#913]: https://github.com/ergebnis/phpstan-rules/pull/913 [#914]: https://github.com/ergebnis/phpstan-rules/pull/914 +[#915]: https://github.com/ergebnis/phpstan-rules/pull/915 [#938]: https://github.com/ergebnis/phpstan-rules/pull/938 [#939]: https://github.com/ergebnis/phpstan-rules/pull/939 [#940]: https://github.com/ergebnis/phpstan-rules/pull/940 @@ -793,6 +828,7 @@ For a full diff see [`362c7ea...0.1.0`][362c7ea...0.1.0]. [#951]: https://github.com/ergebnis/phpstan-rules/pull/951 [#957]: https://github.com/ergebnis/phpstan-rules/pull/957 [#958]: https://github.com/ergebnis/phpstan-rules/pull/958 +[#959]: https://github.com/ergebnis/phpstan-rules/pull/959 [#972]: https://github.com/ergebnis/phpstan-rules/pull/972 [#977]: https://github.com/ergebnis/phpstan-rules/pull/977 [#1009]: https://github.com/ergebnis/phpstan-rules/pull/1009 @@ -802,6 +838,17 @@ For a full diff see [`362c7ea...0.1.0`][362c7ea...0.1.0]. [#1101]: https://github.com/ergebnis/phpstan-rules/pull/1101 [#1139]: https://github.com/ergebnis/phpstan-rules/pull/1139 [#1140]: https://github.com/ergebnis/phpstan-rules/pull/1140 +[#1146]: https://github.com/ergebnis/phpstan-rules/pull/1146 +[#1149]: https://github.com/ergebnis/phpstan-rules/pull/1149 +[#1150]: https://github.com/ergebnis/phpstan-rules/pull/1150 +[#1151]: https://github.com/ergebnis/phpstan-rules/pull/1151 +[#1154]: https://github.com/ergebnis/phpstan-rules/pull/1154 +[#1156]: https://github.com/ergebnis/phpstan-rules/pull/1156 +[#1158]: https://github.com/ergebnis/phpstan-rules/pull/1158 +[#1159]: https://github.com/ergebnis/phpstan-rules/pull/1159 +[#1160]: https://github.com/ergebnis/phpstan-rules/pull/1160 +[#1162]: https://github.com/ergebnis/phpstan-rules/pull/1162 +[#1163]: https://github.com/ergebnis/phpstan-rules/pull/1163 [@alfredbez]: https://github.com/alfredbez [@cosmastech]: https://github.com/cosmastech diff --git a/tools/.phpstan/vendor/ergebnis/phpstan-rules/README.md b/tools/.phpstan/vendor/ergebnis/phpstan-rules/README.md index 0f6e1a05c..bcc6f8c5c 100644 --- a/tools/.phpstan/vendor/ergebnis/phpstan-rules/README.md +++ b/tools/.phpstan/vendor/ergebnis/phpstan-rules/README.md @@ -34,7 +34,7 @@ includes: - vendor/ergebnis/phpstan-rules/rules.neon ``` -:bulb: You probably want to use these rules on top of the rules provided by: +πŸ’‘ You probably want to use these rules on top of the rules provided by: - [`phpstan/phpstan`](https://github.com/phpstan/phpstan) - [`phpstan/phpstan-deprecation-rules`](https://github.com/phpstan/phpstan-deprecation-rules) @@ -42,40 +42,73 @@ includes: ## Rules -This package provides the following rules for use with [`phpstan/phpstan`](https://github.com/phpstan/phpstan): + -- [`Ergebnis\PHPStan\Rules\CallLikes\NoNamedArgumentRule`](https://github.com/ergebnis/phpstan-rules#calllikesnonamedargumentrule) -- [`Ergebnis\PHPStan\Rules\Classes\FinalRule`](https://github.com/ergebnis/phpstan-rules#classesfinalrule) -- [`Ergebnis\PHPStan\Rules\Classes\NoExtendsRule`](https://github.com/ergebnis/phpstan-rules#classesnoextendsrule) -- [`Ergebnis\PHPStan\Rules\Classes\PHPUnit\Framework\TestCaseWithSuffixRule`](https://github.com/ergebnis/phpstan-rules#classesphpunitframeworktestcasewithsuffixrule) -- [`Ergebnis\PHPStan\Rules\Closures\NoNullableReturnTypeDeclarationRule`](https://github.com/ergebnis/phpstan-rules#closuresnonullablereturntypedeclarationrule) -- [`Ergebnis\PHPStan\Rules\Closures\NoParameterPassedByReferenceRule`](https://github.com/ergebnis/phpstan-rules#closuresnoparameterpassedbyreferencerule) -- [`Ergebnis\PHPStan\Rules\Closures\NoParameterWithNullableTypeDeclarationRule`](https://github.com/ergebnis/phpstan-rules#closuresnoparameterwithnullabletypedeclarationrule) -- [`Ergebnis\PHPStan\Rules\Closures\NoParameterWithNullDefaultValueRule`](https://github.com/ergebnis/phpstan-rules#closuresnoparameterwithnulldefaultvaluerule) -- [`Ergebnis\PHPStan\Rules\Expressions\NoAssignByReferenceRule`](https://github.com/ergebnis/phpstan-rules#expressionsnoassignbyreferencerule) -- [`Ergebnis\PHPStan\Rules\Expressions\NoCompactRule`](https://github.com/ergebnis/phpstan-rules#expressionsnocompactrule) -- [`Ergebnis\PHPStan\Rules\Expressions\NoErrorSuppressionRule`](https://github.com/ergebnis/phpstan-rules#expressionsnoerrorsuppressionrule) -- [`Ergebnis\PHPStan\Rules\Expressions\NoEvalRule`](https://github.com/ergebnis/phpstan-rules#expressionsnoevalrule) -- [`Ergebnis\PHPStan\Rules\Expressions\NoIssetRule`](https://github.com/ergebnis/phpstan-rules#expressionsnoissetrule) -- [`Ergebnis\PHPStan\Rules\Files\DeclareStrictTypesRule`](https://github.com/ergebnis/phpstan-rules#filesdeclarestricttypesrule) -- [`Ergebnis\PHPStan\Rules\Files\NoPhpstanIgnoreRule`](https://github.com/ergebnis/phpstan-rules#filesnophpstanignorerule) -- [`Ergebnis\PHPStan\Rules\Functions\NoNullableReturnTypeDeclarationRule`](https://github.com/ergebnis/phpstan-rules#functionsnonullablereturntypedeclarationrule) -- [`Ergebnis\PHPStan\Rules\Functions\NoParameterPassedByReferenceRule`](https://github.com/ergebnis/phpstan-rules#functionsnoparameterpassedbyreferencerule) -- [`Ergebnis\PHPStan\Rules\Functions\NoParameterWithNullableTypeDeclarationRule`](https://github.com/ergebnis/phpstan-rules#functionsnoparameterwithnullabletypedeclarationrule) -- [`Ergebnis\PHPStan\Rules\Functions\NoParameterWithNullDefaultValueRule`](https://github.com/ergebnis/phpstan-rules#functionsnoparameterwithnulldefaultvaluerule) -- [`Ergebnis\PHPStan\Rules\Functions\NoReturnByReferenceRule`](https://github.com/ergebnis/phpstan-rules#functionsnoreturnbyreferencerule) -- [`Ergebnis\PHPStan\Rules\Methods\FinalInAbstractClassRule`](https://github.com/ergebnis/phpstan-rules#methodsfinalinabstractclassrule) -- [`Ergebnis\PHPStan\Rules\Methods\InvokeParentHookMethodRule`](https://github.com/ergebnis/phpstan-rules#methodsinvokeparenthookmethodrule) -- [`Ergebnis\PHPStan\Rules\Methods\NoConstructorParameterWithDefaultValueRule`](https://github.com/ergebnis/phpstan-rules#methodsnoconstructorparameterwithdefaultvaluerule) -- [`Ergebnis\PHPStan\Rules\Methods\NoNullableReturnTypeDeclarationRule`](https://github.com/ergebnis/phpstan-rules#methodsnonullablereturntypedeclarationrule) -- [`Ergebnis\PHPStan\Rules\Methods\NoParameterPassedByReferenceRule`](https://github.com/ergebnis/phpstan-rules#methodsnoparameterpassedbyreferencerule) -- [`Ergebnis\PHPStan\Rules\Methods\NoParameterWithContainerTypeDeclarationRule`](https://github.com/ergebnis/phpstan-rules#methodsnoparameterwithcontainertypedeclarationrule) -- [`Ergebnis\PHPStan\Rules\Methods\NoParameterWithNullableTypeDeclarationRule`](https://github.com/ergebnis/phpstan-rules#methodsnoparameterwithnullabletypedeclarationrule) -- [`Ergebnis\PHPStan\Rules\Methods\NoParameterWithNullDefaultValueRule`](https://github.com/ergebnis/phpstan-rules#methodsnoparameterwithnulldefaultvaluerule) -- [`Ergebnis\PHPStan\Rules\Methods\NoReturnByReferenceRule`](https://github.com/ergebnis/phpstan-rules#methodsnoreturnbyreferencerule) -- [`Ergebnis\PHPStan\Rules\Methods\PrivateInFinalClassRule`](https://github.com/ergebnis/phpstan-rules#methodsprivateinfinalclassrule) -- [`Ergebnis\PHPStan\Rules\Statements\NoSwitchRule`](https://github.com/ergebnis/phpstan-rules#statementsnoswitchrule) +This package provides the following rules for use with [`phpstan/phpstan`](https://github.com/phpstan/phpstan): +- [`Ergebnis\PHPStan\Rules\ArrowFunctions\NoNullableReturnTypeDeclarationRule`](#arrowfunctionsnonullablereturntypedeclarationrule) +- [`Ergebnis\PHPStan\Rules\ArrowFunctions\NoParameterPassedByReferenceRule`](#arrowfunctionsnoparameterpassedbyreferencerule) +- [`Ergebnis\PHPStan\Rules\ArrowFunctions\NoParameterWithNullDefaultValueRule`](#arrowfunctionsnoparameterwithnulldefaultvaluerule) +- [`Ergebnis\PHPStan\Rules\ArrowFunctions\NoParameterWithNullableTypeDeclarationRule`](#arrowfunctionsnoparameterwithnullabletypedeclarationrule) +- [`Ergebnis\PHPStan\Rules\CallLikes\NoNamedArgumentRule`](#calllikesnonamedargumentrule) +- [`Ergebnis\PHPStan\Rules\Classes\FinalRule`](#classesfinalrule) +- [`Ergebnis\PHPStan\Rules\Classes\NoExtendsRule`](#classesnoextendsrule) +- [`Ergebnis\PHPStan\Rules\Classes\PHPUnit\Framework\TestCaseWithSuffixRule`](#classesphpunitframeworktestcasewithsuffixrule) +- [`Ergebnis\PHPStan\Rules\Closures\NoNullableReturnTypeDeclarationRule`](#closuresnonullablereturntypedeclarationrule) +- [`Ergebnis\PHPStan\Rules\Closures\NoParameterPassedByReferenceRule`](#closuresnoparameterpassedbyreferencerule) +- [`Ergebnis\PHPStan\Rules\Closures\NoParameterWithNullDefaultValueRule`](#closuresnoparameterwithnulldefaultvaluerule) +- [`Ergebnis\PHPStan\Rules\Closures\NoParameterWithNullableTypeDeclarationRule`](#closuresnoparameterwithnullabletypedeclarationrule) +- [`Ergebnis\PHPStan\Rules\Expressions\NoAssignByReferenceRule`](#expressionsnoassignbyreferencerule) +- [`Ergebnis\PHPStan\Rules\Expressions\NoCompactRule`](#expressionsnocompactrule) +- [`Ergebnis\PHPStan\Rules\Expressions\NoErrorSuppressionRule`](#expressionsnoerrorsuppressionrule) +- [`Ergebnis\PHPStan\Rules\Expressions\NoEvalRule`](#expressionsnoevalrule) +- [`Ergebnis\PHPStan\Rules\Expressions\NoIssetRule`](#expressionsnoissetrule) +- [`Ergebnis\PHPStan\Rules\Files\DeclareStrictTypesRule`](#filesdeclarestricttypesrule) +- [`Ergebnis\PHPStan\Rules\Files\NoPhpstanIgnoreRule`](#filesnophpstanignorerule) +- [`Ergebnis\PHPStan\Rules\Functions\NoNullableReturnTypeDeclarationRule`](#functionsnonullablereturntypedeclarationrule) +- [`Ergebnis\PHPStan\Rules\Functions\NoParameterPassedByReferenceRule`](#functionsnoparameterpassedbyreferencerule) +- [`Ergebnis\PHPStan\Rules\Functions\NoParameterWithNullDefaultValueRule`](#functionsnoparameterwithnulldefaultvaluerule) +- [`Ergebnis\PHPStan\Rules\Functions\NoParameterWithNullableTypeDeclarationRule`](#functionsnoparameterwithnullabletypedeclarationrule) +- [`Ergebnis\PHPStan\Rules\Functions\NoReturnByReferenceRule`](#functionsnoreturnbyreferencerule) +- [`Ergebnis\PHPStan\Rules\Methods\FinalInAbstractClassRule`](#methodsfinalinabstractclassrule) +- [`Ergebnis\PHPStan\Rules\Methods\InvokeParentHookMethodRule`](#methodsinvokeparenthookmethodrule) +- [`Ergebnis\PHPStan\Rules\Methods\NoConstructorParameterWithDefaultValueRule`](#methodsnoconstructorparameterwithdefaultvaluerule) +- [`Ergebnis\PHPStan\Rules\Methods\NoNullableReturnTypeDeclarationRule`](#methodsnonullablereturntypedeclarationrule) +- [`Ergebnis\PHPStan\Rules\Methods\NoParameterPassedByReferenceRule`](#methodsnoparameterpassedbyreferencerule) +- [`Ergebnis\PHPStan\Rules\Methods\NoParameterWithContainerTypeDeclarationRule`](#methodsnoparameterwithcontainertypedeclarationrule) +- [`Ergebnis\PHPStan\Rules\Methods\NoParameterWithNullDefaultValueRule`](#methodsnoparameterwithnulldefaultvaluerule) +- [`Ergebnis\PHPStan\Rules\Methods\NoParameterWithNullableTypeDeclarationRule`](#methodsnoparameterwithnullabletypedeclarationrule) +- [`Ergebnis\PHPStan\Rules\Methods\NoReturnByReferenceRule`](#methodsnoreturnbyreferencerule) +- [`Ergebnis\PHPStan\Rules\Methods\PrivateInFinalClassRule`](#methodsprivateinfinalclassrule) +- [`Ergebnis\PHPStan\Rules\PropertyHooks\NoParameterWithNullableTypeDeclarationRule`](#propertyhooksnoparameterwithnullabletypedeclarationrule) +- [`Ergebnis\PHPStan\Rules\PropertyHooks\NoReturnByReferenceRule`](#propertyhooksnoreturnbyreferencerule) +- [`Ergebnis\PHPStan\Rules\Statements\NoSwitchRule`](#statementsnoswitchrule) + +### ArrowFunctions + +#### `ArrowFunctions\NoNullableReturnTypeDeclarationRule` + +This rule reports an error when an arrow function uses a nullable return type declaration. + +πŸ’‘ Find out more in the rule documentation for [`ArrowFunctions\NoNullableReturnTypeDeclarationRule`](doc/rules/ArrowFunctions/NoNullableReturnTypeDeclarationRule.md). + +#### `ArrowFunctions\NoParameterPassedByReferenceRule` + +This rule reports an error when an arrow function has a parameter that is [passed by reference](https://www.php.net/manual/en/language.references.pass.php). + +πŸ’‘ Find out more in the rule documentation for [`ArrowFunctions\NoParameterPassedByReferenceRule`](doc/rules/ArrowFunctions/NoParameterPassedByReferenceRule.md). + +#### `ArrowFunctions\NoParameterWithNullDefaultValueRule` + +This rule reports an error when an arrow function has a parameter with `null` as default value. + +πŸ’‘ Find out more in the rule documentation for [`ArrowFunctions\NoParameterWithNullDefaultValueRule`](doc/rules/ArrowFunctions/NoParameterWithNullDefaultValueRule.md). + +#### `ArrowFunctions\NoParameterWithNullableTypeDeclarationRule` + +This rule reports an error when an arrow function has a parameter with a nullable type declaration. + +πŸ’‘ Find out more in the rule documentation for [`ArrowFunctions\NoParameterWithNullableTypeDeclarationRule`](doc/rules/ArrowFunctions/NoParameterWithNullableTypeDeclarationRule.md). ### CallLikes @@ -83,16 +116,7 @@ This package provides the following rules for use with [`phpstan/phpstan`](https This rule reports an error when an anonymous function, a function, or a method is invoked using a [named argument](https://www.php.net/manual/en/functions.arguments.php#functions.named-arguments). -##### Disabling the rule - -You can set the `enabled` parameter to `false` to disable this rule. - -```neon -parameters: - ergebnis: - noNamedArgument: - enabled: false -``` +πŸ’‘ Find out more in the rule documentation for [`CallLikes\NoNamedArgumentRule`](doc/rules/CallLikes/NoNamedArgumentRule.md). ### Classes @@ -100,98 +124,26 @@ parameters: This rule reports an error when a non-anonymous class is not `final`. -:bulb: This rule ignores classes that +πŸ’‘ By default, this rule ignores classes that - use `@Entity`, `@ORM\Entity`, or `@ORM\Mapping\Entity` annotations - use `Doctrine\ORM\Mapping\Entity` attributes on the class level. -##### Disabling the rule - -You can set the `enabled` parameter to `false` to disable this rule. - -```neon -parameters: - ergebnis: - final: - enabled: false -``` - -##### Disallowing `abstract` classes - -By default, this rule allows to declare `abstract` classes. - -You can set the `allowAbstractClasses` parameter to `false` to disallow abstract classes. - -```neon -parameters: - ergebnis: - final: - allowAbstractClasses: false -``` - -##### Excluding classes from inspection - -You can set the `classesNotRequiredToBeAbstractOrFinal` parameter to a list of class names that you want to exclude from inspection. - -```neon -parameters: - ergebnis: - final: - classesNotRequiredToBeAbstractOrFinal: - - Foo\Bar\NeitherAbstractNorFinal - - Bar\Baz\NeitherAbstractNorFinal -``` +πŸ’‘ Find out more in the rule documentation for [`Classes\FinalRule`](doc/rules/Classes/FinalRule.md). #### `Classes\NoExtendsRule` This rule reports an error when a class extends another class. -##### Defaults - -By default, this rule allows the following classes to be extended: - -- [`PHPUnit\Framework\TestCase`](https://github.com/sebastianbergmann/phpunit/blob/6.0.0/src/Framework/TestCase.php) - -##### Disabling the rule - -You can set the `enabled` parameter to `false` to disable this rule. - -```neon -parameters: - ergebnis: - noExtends: - enabled: false -``` - -##### Allowing classes to be extended - -You can set the `classesAllowedToBeExtended` parameter to a list of class names that you want to allow to be extended. - -```neon -parameters: - ergebnis: - noExtends: - classesAllowedToBeExtended: - - Ergebnis\PHPStan\Rules\Test\Integration\AbstractTestCase - - Ergebnis\PHPStan\Rules\Test\Integration\AbstractTestCase -``` +πŸ’‘ Find out more in the rule documentation for [`Classes\NoExtendsRule`](doc/rules/Classes/NoExtendsRule.md). #### `Classes\PHPUnit\Framework\TestCaseWithSuffixRule` This rule reports an error when a concrete class is a sub-class of `PHPUnit\Framework\TestCase` but does not have a `Test` suffix. -##### Disabling the rule - -You can set the `enabled` parameter to `false` to disable this rule. - -```neon -parameters: - ergebnis: - testCaseWithSuffix: - enabled: false -``` +πŸ’‘ Find out more in the rule documentation for [`Classes\PHPUnit\Framework\TestCaseWithSuffixRule`](doc/rules/Classes/PHPUnit/Framework/TestCaseWithSuffixRule.md). ### Closures @@ -199,61 +151,25 @@ parameters: This rule reports an error when a closure uses a nullable return type declaration. -##### Disabling the rule - -You can set the `enabled` parameter to `false` to disable this rule. - -```neon -parameters: - ergebnis: - noNullableReturnTypeDeclaration: - enabled: false -``` +πŸ’‘ Find out more in the rule documentation for [`Closures\NoNullableReturnTypeDeclarationRule`](doc/rules/Closures/NoNullableReturnTypeDeclarationRule.md). #### `Closures\NoParameterPassedByReferenceRule` This rule reports an error when a closure has a parameter that is [passed by reference](https://www.php.net/manual/en/language.references.pass.php). -##### Disabling the rule - -You can set the `enabled` parameter to `false` to disable this rule. - -```neon -parameters: - ergebnis: - noParameterPassedByReference: - enabled: false -``` - -#### `Closures\NoParameterWithNullableTypeDeclarationRule` - -This rule reports an error when a closure has a parameter with a nullable type declaration. - -##### Disabling the rule - -You can set the `enabled` parameter to `false` to disable this rule. - -```neon -parameters: - ergebnis: - noParameterWithNullableTypeDeclaration: - enabled: false -``` +πŸ’‘ Find out more in the rule documentation for [`Closures\NoParameterPassedByReferenceRule`](doc/rules/Closures/NoParameterPassedByReferenceRule.md). #### `Closures\NoParameterWithNullDefaultValueRule` This rule reports an error when a closure has a parameter with `null` as default value. -##### Disabling the rule +πŸ’‘ Find out more in the rule documentation for [`Closures\NoParameterWithNullDefaultValueRule`](doc/rules/Closures/NoParameterWithNullDefaultValueRule.md). -You can set the `enabled` parameter to `false` to disable this rule. +#### `Closures\NoParameterWithNullableTypeDeclarationRule` -```neon -parameters: - ergebnis: - noParameterWithNullDefaultValue: - enabled: false -``` +This rule reports an error when a closure has a parameter with a nullable type declaration. + +πŸ’‘ Find out more in the rule documentation for [`Closures\NoParameterWithNullableTypeDeclarationRule`](doc/rules/Closures/NoParameterWithNullableTypeDeclarationRule.md). ### Expressions @@ -261,76 +177,31 @@ parameters: This rule reports an error when [a variable is assigned by reference](https://www.php.net/manual/en/language.references.whatdo.php#language.references.whatdo.assign). -##### Disabling the rule - -You can set the `enabled` parameter to `false` to disable this rule. - -```neon -parameters: - ergebnis: - noAssignByReference: - enabled: false -``` +πŸ’‘ Find out more in the rule documentation for [`Expressions\NoAssignByReferenceRule`](doc/rules/Expressions/NoAssignByReferenceRule.md). #### `Expressions\NoCompactRule` This rule reports an error when the function [`compact()`](https://www.php.net/compact) is used. -##### Disabling the rule - -You can set the `enabled` parameter to `false` to disable this rule. - -```neon -parameters: - ergebnis: - noCompact: - enabled: false -``` +πŸ’‘ Find out more in the rule documentation for [`Expressions\NoCompactRule`](doc/rules/Expressions/NoCompactRule.md). #### `Expressions\NoErrorSuppressionRule` This rule reports an error when [`@`](https://www.php.net/manual/en/language.operators.errorcontrol.php) is used to suppress errors. -##### Disabling the rule - -You can set the `enabled` parameter to `false` to disable this rule. - -```neon -parameters: - ergebnis: - noErrorSuppression: - enabled: false -``` +πŸ’‘ Find out more in the rule documentation for [`Expressions\NoErrorSuppressionRule`](doc/rules/Expressions/NoErrorSuppressionRule.md). #### `Expressions\NoEvalRule` This rule reports an error when the language construct [`eval()`](https://www.php.net/eval) is used. -##### Disabling the rule - -You can set the `enabled` parameter to `false` to disable this rule. - -```neon -parameters: - ergebnis: - noEval: - enabled: false -``` +πŸ’‘ Find out more in the rule documentation for [`Expressions\NoEvalRule`](doc/rules/Expressions/NoEvalRule.md). #### `Expressions\NoIssetRule` This rule reports an error when the language construct [`isset()`](https://www.php.net/isset) is used. -##### Disabling the rule - -You can set the `enabled` parameter to `false` to disable this rule. - -```neon -parameters: - ergebnis: - noIsset: - enabled: false -``` +πŸ’‘ Find out more in the rule documentation for [`Expressions\NoIssetRule`](doc/rules/Expressions/NoIssetRule.md). ### Files @@ -338,31 +209,13 @@ parameters: This rule reports an error when a non-empty file does not contain a `declare(strict_types=1)` declaration. -##### Disabling the rule - -You can set the `enabled` parameter to `false` to disable this rule. - -```neon -parameters: - ergebnis: - declareStrictTypes: - enabled: false -``` +πŸ’‘ Find out more in the rule documentation for [`Files\DeclareStrictTypesRule`](doc/rules/Files/DeclareStrictTypesRule.md). #### `Files\NoPhpstanIgnoreRule` This rule reports an error when a `@phpstan-ignore`, `@phpstan-ignore-line`, or `@phpstan-ignore-next-line` tag is used to [ignore errors reported by `phpstan/phpstan`](https://phpstan.org/user-guide/ignoring-errors#ignoring-in-code-using-phpdocs). -##### Disabling the rule - -You can set the `enabled` parameter to `false` to disable this rule. - -```neon -parameters: - ergebnis: - noPhpstanIgnore: - enabled: false -``` +πŸ’‘ Find out more in the rule documentation for [`Files\NoPhpstanIgnoreRule`](doc/rules/Files/NoPhpstanIgnoreRule.md). ### Functions @@ -370,76 +223,31 @@ parameters: This rule reports an error when a function uses a nullable return type declaration. -##### Disabling the rule - -You can set the `enabled` parameter to `false` to disable this rule. - -```neon -parameters: - ergebnis: - noNullableReturnTypeDeclaration: - enabled: false -``` +πŸ’‘ Find out more in the rule documentation for [`Functions\NoNullableReturnTypeDeclarationRule`](doc/rules/Functions/NoNullableReturnTypeDeclarationRule.md). #### `Functions\NoParameterPassedByReferenceRule` This rule reports an error when a function has a parameter that is [passed by reference](https://www.php.net/manual/en/language.references.pass.php). -##### Disabling the rule - -You can set the `enabled` parameter to `false` to disable this rule. - -```neon -parameters: - ergebnis: - noParameterPassedByReference: - enabled: false -``` - -#### `Functions\NoParameterWithNullableTypeDeclarationRule` - -This rule reports an error when a function has a parameter with a nullable type declaration. - -##### Disabling the rule - -You can set the `enabled` parameter to `false` to disable this rule. - -```neon -parameters: - ergebnis: - noParameterWithNullableTypeDeclaration: - enabled: false -``` +πŸ’‘ Find out more in the rule documentation for [`Functions\NoParameterPassedByReferenceRule`](doc/rules/Functions/NoParameterPassedByReferenceRule.md). #### `Functions\NoParameterWithNullDefaultValueRule` This rule reports an error when a function has a parameter with `null` as default value. -##### Disabling the rule +πŸ’‘ Find out more in the rule documentation for [`Functions\NoParameterWithNullDefaultValueRule`](doc/rules/Functions/NoParameterWithNullDefaultValueRule.md). -You can set the `enabled` parameter to `false` to disable this rule. +#### `Functions\NoParameterWithNullableTypeDeclarationRule` -```neon -parameters: - ergebnis: - noParameterWithNullDefaultValue: - enabled: false -``` +This rule reports an error when a function has a parameter with a nullable type declaration. + +πŸ’‘ Find out more in the rule documentation for [`Functions\NoParameterWithNullableTypeDeclarationRule`](doc/rules/Functions/NoParameterWithNullableTypeDeclarationRule.md). #### `Functions\NoReturnByReferenceRule` This rule reports an error when a function [returns by reference](https://www.php.net/manual/en/language.references.return.php). -##### Disabling the rule - -You can set the `enabled` parameter to `false` to disable this rule. - -```neon -parameters: - ergebnis: - noReturnByReference: - enabled: false -``` +πŸ’‘ Find out more in the rule documentation for [`Functions\NoReturnByReferenceRule`](doc/rules/Functions/NoReturnByReferenceRule.md). ### Methods @@ -447,254 +255,77 @@ parameters: This rule reports an error when a concrete `public` or `protected` method in an `abstract` class is not `final`. -:bulb: This rule ignores - -- Doctrine embeddables -- Doctrine entities - -##### Disabling the rule +πŸ’‘ By default, this rule ignores Doctrine entities. -You can set the `enabled` parameter to `false` to disable this rule. - -```neon -parameters: - ergebnis: - finalInAbstractClass: - enabled: false -``` +πŸ’‘ Find out more in the rule documentation for [`Methods\FinalInAbstractClassRule`](doc/rules/Methods/FinalInAbstractClassRule.md). #### `Methods\InvokeParentHookMethodRule` This rule reports an error when a hook method that overrides a hook method in a parent class does not invoke the overridden hook method in the expected order. -##### Defaults - -By default, this rule requires the following hook methods to be invoked before doing something in the overriding method: - -- [`Codeception\PHPUnit\TestCase::_setUp()`](https://github.com/Codeception/phpunit-wrapper/blob/9.0.0/src/TestCase.php#L11-L13) -- [`Codeception\PHPUnit\TestCase::_setUpBeforeClass()`](https://github.com/Codeception/phpunit-wrapper/blob/9.0.0/src/TestCase.php#L25-L27) -- [`Codeception\Test\Unit::_before()`](https://github.com/Codeception/Codeception/blob/4.2.2/src/Codeception/Test/Unit.php#L63-L65) -- [`Codeception\Test\Unit::_setUp()`](https://github.com/Codeception/Codeception/blob/4.2.2/src/Codeception/Test/Unit.php#L34-L58) -- [`PHPUnit\Framework\TestCase::assertPreConditions()`](https://github.com/sebastianbergmann/phpunit/blob/6.0.0/src/Framework/TestCase.php#L2073-L2075) -- [`PHPUnit\Framework\TestCase::setUp()`](https://github.com/sebastianbergmann/phpunit/blob/6.0.0/src/Framework/TestCase.php#L2063-L2065) -- [`PHPUnit\Framework\TestCase::setUpBeforeClass()`](https://github.com/sebastianbergmann/phpunit/blob/6.0.0/src/Framework/TestCase.php#L2055-L2057) - -By default, this rule requires the following hook methods to be invoked after doing something in the overriding method: - -- [`Codeception\PHPUnit\TestCase::_tearDown()`](https://github.com/Codeception/phpunit-wrapper/blob/9.0.0/src/TestCase.php#L18-L20) -- [`Codeception\PHPUnit\TestCase::_tearDownAfterClass()`](https://github.com/Codeception/phpunit-wrapper/blob/9.0.0/src/TestCase.php#L32-L34) -- [`Codeception\Test\Unit::_after()`](https://github.com/Codeception/Codeception/blob/4.2.2/src/Codeception/Test/Unit.php#L75-L77) -- [`Codeception\Test\Unit::_tearDown()`](https://github.com/Codeception/Codeception/blob/4.2.2/src/Codeception/Test/Unit.php#L67-L70) -- [`PHPUnit\Framework\TestCase::assertPostConditions()`](https://github.com/sebastianbergmann/phpunit/blob/6.0.0/src/Framework/TestCase.php#L2083-L2085) -- [`PHPUnit\Framework\TestCase::tearDown()`](https://github.com/sebastianbergmann/phpunit/blob/6.0.0/src/Framework/TestCase.php#L2091-L2093) -- [`PHPUnit\Framework\TestCase::tearDownAfterClass()`](https://github.com/sebastianbergmann/phpunit/blob/6.0.0/src/Framework/TestCase.php#L2098-L2100) - -##### Disabling the rule - -You can set the `enabled` parameter to `false` to disable this rule. - -```neon -parameters: - ergebnis: - invokeParentHookMethod: - enabled: false -``` - -##### Configuring methods to invoke the parent method in the right order: - -You can set the `hookMethods` parameter to a list of hook methods: - -```neon -parameters: - ergebnis: - invokeParentHookMethod: - hookMethods: - - className: "Example\Test\Functional\AbstractCest" - methodName: "_before" - hasContent: "yes" - invocation: "first" -``` - -- `className`: name of the class that declares the hook method -- `methodName`: name of the hook method -- `hasContent`: one of `"yes"`, `"no"`, `"maybe"` -- `invocation`: one of `"any"` (needs to be invoked), `"first"` (needs to be invoked before all other statements in the overriding hook method, `"last"` (needs to be invoked after all other statements in the overriding hook method) +πŸ’‘ Find out more in the rule documentation for [`Methods\InvokeParentHookMethodRule`](doc/rules/Methods/InvokeParentHookMethodRule.md). #### `Methods\NoConstructorParameterWithDefaultValueRule` -This rule reports an error when a constructor declared in - -- an anonymous class -- a class +This rule reports an error when a constructor has a parameter with a default value. -has a default value. +πŸ’‘ Find out more in the rule documentation for [`Methods\NoConstructorParameterWithDefaultValueRule`](doc/rules/Methods/NoConstructorParameterWithDefaultValueRule.md). -##### Disabling the rule +#### `Methods\NoNullableReturnTypeDeclarationRule` -You can set the `enabled` parameter to `false` to disable this rule. +This rule reports an error when a method uses a nullable return type declaration. -```neon -parameters: - ergebnis: - noConstructorParameterWithDefaultValue: - enabled: false -``` +πŸ’‘ Find out more in the rule documentation for [`Methods\NoNullableReturnTypeDeclarationRule`](doc/rules/Methods/NoNullableReturnTypeDeclarationRule.md). #### `Methods\NoParameterPassedByReferenceRule` This rule reports an error when a method has a parameter that is [passed by reference](https://www.php.net/manual/en/language.references.pass.php). -##### Disabling the rule - -You can set the `enabled` parameter to `false` to disable this rule. - -```neon -parameters: - ergebnis: - noParameterPassedByReference: - enabled: false -``` - -#### `Methods\NoNullableReturnTypeDeclarationRule` - -This rule reports an error when a method declared in - -- an anonymous class -- a class -- an interface - -uses a nullable return type declaration. - -##### Disabling the rule - -You can set the `enabled` parameter to `false` to disable this rule. - -```neon -parameters: - ergebnis: - noNullableReturnTypeDeclaration: - enabled: false -``` +πŸ’‘ Find out more in the rule documentation for [`Methods\NoParameterPassedByReferenceRule`](doc/rules/Methods/NoParameterPassedByReferenceRule.md). #### `Methods\NoParameterWithContainerTypeDeclarationRule` This rule reports an error when a method has a type declaration for a known dependency injection container or service locator. -##### Defaults - -By default, this rule disallows the use of type declarations indicating an implementation of - -- [`Psr\Container\ContainerInterface`](https://github.com/php-fig/container/blob/1.0.0/src/ContainerInterface.php) - -is expected to be injected into a method. - -##### Disabling the rule - -You can set the `enabled` parameter to `false` to disable this rule. - -```neon -parameters: - ergebnis: - noParameterWithContainerTypeDeclaration: - enabled: false -``` - -##### Configuring container interfaces - -You can set the `interfacesImplementedByContainers` parameter to a list of interface names of additional containers and service locators. +πŸ’‘ Find out more in the rule documentation for [`Methods\NoParameterWithContainerTypeDeclarationRule`](doc/rules/Methods/NoParameterWithContainerTypeDeclarationRule.md). -```neon -parameters: - ergebnis: - noParameterWithContainerTypeDeclaration: - interfacesImplementedByContainers: - - Fancy\DependencyInjection\ContainerInterface - - Other\ServiceLocatorInterface -``` +#### `Methods\NoParameterWithNullDefaultValueRule` -##### Configuring methods allowed to use parameters with container type declarations +This rule reports an error when a method has a parameter with `null` as default value. -You can set the `methodsAllowedToUseContainerTypeDeclarations` parameter to a list of method names that are allowed to use parameters with container type declarations. - -```neon -parameters: - ergebnis: - noParameterWithContainerTypeDeclaration: - methodsAllowedToUseContainerTypeDeclarations: - - loadExtension -``` +πŸ’‘ Find out more in the rule documentation for [`Methods\NoParameterWithNullDefaultValueRule`](doc/rules/Methods/NoParameterWithNullDefaultValueRule.md). #### `Methods\NoParameterWithNullableTypeDeclarationRule` -This rule reports an error when a method declared in - -- an anonymous class -- a class -- an interface +This rule reports an error when a method has a parameter with a nullable type declaration. -has a parameter with a nullable type declaration. +πŸ’‘ Find out more in the rule documentation for [`Methods\NoParameterWithNullableTypeDeclarationRule`](doc/rules/Methods/NoParameterWithNullableTypeDeclarationRule.md). -##### Disabling the rule +#### `Methods\NoReturnByReferenceRule` -You can set the `enabled` parameter to `false` to disable this rule. - -```neon -parameters: - ergebnis: - noParameterWithNullableTypeDeclaration: - enabled: false -``` +This rule reports an error when a method [returns by reference](https://www.php.net/manual/en/language.references.return.php). -#### `Methods\NoParameterWithNullDefaultValueRule` +πŸ’‘ Find out more in the rule documentation for [`Methods\NoReturnByReferenceRule`](doc/rules/Methods/NoReturnByReferenceRule.md). -This rule reports an error when a method declared in +#### `Methods\PrivateInFinalClassRule` -- an anonymous class -- a class -- an interface +This rule reports an error when a method in a `final` class is `protected` but could be `private`. -has a parameter with `null` as default value. +πŸ’‘ Find out more in the rule documentation for [`Methods\PrivateInFinalClassRule`](doc/rules/Methods/PrivateInFinalClassRule.md). -##### Disabling the rule +### PropertyHooks -You can set the `enabled` parameter to `false` to disable this rule. +#### `PropertyHooks\NoParameterWithNullableTypeDeclarationRule` -```neon -parameters: - ergebnis: - noParameterWithNullDefaultValue: - enabled: false -``` +This rule reports an error when a [property hook](https://www.php.net/manual/en/language.oop5.property-hooks.php) has a parameter with a nullable type declaration. -#### `Functions\NoReturnByReferenceRule` - -This rule reports an error when a method [returns by reference](https://www.php.net/manual/en/language.references.return.php). +πŸ’‘ Find out more in the rule documentation for [`PropertyHooks\NoParameterWithNullableTypeDeclarationRule`](doc/rules/PropertyHooks/NoParameterWithNullableTypeDeclarationRule.md). -##### Disabling the rule +#### `PropertyHooks\NoReturnByReferenceRule` -You can set the `enabled` parameter to `false` to disable this rule. +This rule reports an error when a [property hook](https://www.php.net/manual/en/language.oop5.property-hooks.php) returns by reference. -```neon -parameters: - ergebnis: - noReturnByReference: - enabled: false -``` - -#### `Methods\PrivateInFinalClassRule` - -This rule reports an error when a method in a `final` class is `protected` but could be `private`. - -##### Disabling the rule - -You can set the `enabled` parameter to `false` to disable this rule. - -```neon -parameters: - ergebnis: - privateInFinalClass: - enabled: false -``` +πŸ’‘ Find out more in the rule documentation for [`PropertyHooks\NoReturnByReferenceRule`](doc/rules/PropertyHooks/NoReturnByReferenceRule.md). ### Statements @@ -702,16 +333,9 @@ parameters: This rule reports an error when the statement [`switch()`](https://www.php.net/manual/control-structures.switch.php) is used. -##### Disabling the rule - -You can set the `enabled` parameter to `false` to disable this rule. +πŸ’‘ Find out more in the rule documentation for [`Statements\NoSwitchRule`](doc/rules/Statements/NoSwitchRule.md). -```neon -parameters: - ergebnis: - noSwitch: - enabled: false -``` + ## Disabling all rules diff --git a/tools/.phpstan/vendor/ergebnis/phpstan-rules/composer.json b/tools/.phpstan/vendor/ergebnis/phpstan-rules/composer.json index 8a996e032..775fb9d7c 100644 --- a/tools/.phpstan/vendor/ergebnis/phpstan-rules/composer.json +++ b/tools/.phpstan/vendor/ergebnis/phpstan-rules/composer.json @@ -23,6 +23,7 @@ "require": { "php": "~7.4.0 || ~8.0.0 || ~8.1.0 || ~8.2.0 || ~8.3.0 || ~8.4.0 || ~8.5.0 || ~8.6.0", "ext-mbstring": "*", + "composer-runtime-api": "^2.0.0", "phpstan/phpstan": "^2.1.35" }, "require-dev": { @@ -36,11 +37,11 @@ "fakerphp/faker": "^1.24.1", "phpstan/extension-installer": "^1.4.3", "phpstan/phpstan-deprecation-rules": "^2.0.5", - "phpstan/phpstan-phpunit": "^2.0.21", + "phpstan/phpstan-phpunit": "^2.1.1", "phpstan/phpstan-strict-rules": "^2.1.0", "phpunit/phpunit": "^9.6.33", "psr/container": "^2.0.2", - "rector/rector": "^2.3.8", + "rector/rector": "^2.7.0", "symfony/finder": "^5.4.45", "symfony/process": "^5.4.51" }, @@ -71,7 +72,7 @@ }, "extra": { "branch-alias": { - "dev-main": "2.14-dev" + "dev-main": "2.16-dev" }, "phpstan": { "includes": [ diff --git a/tools/.phpstan/vendor/ergebnis/phpstan-rules/doc/rules/ArrowFunctions/NoNullableReturnTypeDeclarationRule.md b/tools/.phpstan/vendor/ergebnis/phpstan-rules/doc/rules/ArrowFunctions/NoNullableReturnTypeDeclarationRule.md new file mode 100644 index 000000000..0756af494 --- /dev/null +++ b/tools/.phpstan/vendor/ergebnis/phpstan-rules/doc/rules/ArrowFunctions/NoNullableReturnTypeDeclarationRule.md @@ -0,0 +1,50 @@ +# `ArrowFunctions\NoNullableReturnTypeDeclarationRule` + +This rule reports an error when an arrow function uses a nullable return type declaration. + +## Rationale + +A nullable return type forces every caller to handle `null`. Throwing an exception, returning a null object, or splitting the arrow function in two keeps the callers simpler. + +## Examples + +### Reported + +```php + \strtoupper($value); +``` + +### Not reported + +```php + \strtoupper($value); +``` + +## Parameters + +### `enabled` + +By default, this rule is enabled, unless you set the [`allRules`](../../../README.md#disabling-all-rules) parameter to `false`. + +You can set the `enabled` parameter to `false` to disable this rule. + +```neon +parameters: + ergebnis: + noNullableReturnTypeDeclaration: + enabled: false +``` + +πŸ’‘ The `enabled` parameter for `noNullableReturnTypeDeclaration` also enables or disables the following rules: + +- [`Closures\NoNullableReturnTypeDeclarationRule`](../../../doc/rules/Closures/NoNullableReturnTypeDeclarationRule.md) +- [`Functions\NoNullableReturnTypeDeclarationRule`](../../../doc/rules/Functions/NoNullableReturnTypeDeclarationRule.md) +- [`Methods\NoNullableReturnTypeDeclarationRule`](../../../doc/rules/Methods/NoNullableReturnTypeDeclarationRule.md) diff --git a/tools/.phpstan/vendor/ergebnis/phpstan-rules/doc/rules/ArrowFunctions/NoParameterPassedByReferenceRule.md b/tools/.phpstan/vendor/ergebnis/phpstan-rules/doc/rules/ArrowFunctions/NoParameterPassedByReferenceRule.md new file mode 100644 index 000000000..af5358a6c --- /dev/null +++ b/tools/.phpstan/vendor/ergebnis/phpstan-rules/doc/rules/ArrowFunctions/NoParameterPassedByReferenceRule.md @@ -0,0 +1,50 @@ +# `ArrowFunctions\NoParameterPassedByReferenceRule` + +This rule reports an error when an arrow function has a parameter that is [passed by reference](https://www.php.net/manual/en/language.references.pass.php). + +## Rationale + +A parameter passed by reference lets an arrow function change a variable of its caller as a side effect, which makes the code harder to follow. Return the new value instead. + +## Examples + +### Reported + +```php + $value + 1; +``` + +### Not reported + +```php + $value + 1; +``` + +## Parameters + +### `enabled` + +By default, this rule is enabled, unless you set the [`allRules`](../../../README.md#disabling-all-rules) parameter to `false`. + +You can set the `enabled` parameter to `false` to disable this rule. + +```neon +parameters: + ergebnis: + noParameterPassedByReference: + enabled: false +``` + +πŸ’‘ The `enabled` parameter for `noParameterPassedByReference` also enables or disables the following rules: + +- [`Closures\NoParameterPassedByReferenceRule`](../../../doc/rules/Closures/NoParameterPassedByReferenceRule.md) +- [`Functions\NoParameterPassedByReferenceRule`](../../../doc/rules/Functions/NoParameterPassedByReferenceRule.md) +- [`Methods\NoParameterPassedByReferenceRule`](../../../doc/rules/Methods/NoParameterPassedByReferenceRule.md) diff --git a/tools/.phpstan/vendor/ergebnis/phpstan-rules/doc/rules/ArrowFunctions/NoParameterWithNullDefaultValueRule.md b/tools/.phpstan/vendor/ergebnis/phpstan-rules/doc/rules/ArrowFunctions/NoParameterWithNullDefaultValueRule.md new file mode 100644 index 000000000..ebf2f2584 --- /dev/null +++ b/tools/.phpstan/vendor/ergebnis/phpstan-rules/doc/rules/ArrowFunctions/NoParameterWithNullDefaultValueRule.md @@ -0,0 +1,50 @@ +# `ArrowFunctions\NoParameterWithNullDefaultValueRule` + +This rule reports an error when an arrow function has a parameter with `null` as default value. + +## Rationale + +A parameter with `null` as its default value makes the argument optional and nullable at once, so the arrow function has to handle a missing value. Separate arrow functions or a null object make each case explicit. + +## Examples + +### Reported + +```php + \strtoupper((string) $value); +``` + +### Not reported + +```php + \strtoupper($value); +``` + +## Parameters + +### `enabled` + +By default, this rule is enabled, unless you set the [`allRules`](../../../README.md#disabling-all-rules) parameter to `false`. + +You can set the `enabled` parameter to `false` to disable this rule. + +```neon +parameters: + ergebnis: + noParameterWithNullDefaultValue: + enabled: false +``` + +πŸ’‘ The `enabled` parameter for `noParameterWithNullDefaultValue` also enables or disables the following rules: + +- [`Closures\NoParameterWithNullDefaultValueRule`](../../../doc/rules/Closures/NoParameterWithNullDefaultValueRule.md) +- [`Functions\NoParameterWithNullDefaultValueRule`](../../../doc/rules/Functions/NoParameterWithNullDefaultValueRule.md) +- [`Methods\NoParameterWithNullDefaultValueRule`](../../../doc/rules/Methods/NoParameterWithNullDefaultValueRule.md) diff --git a/tools/.phpstan/vendor/ergebnis/phpstan-rules/doc/rules/ArrowFunctions/NoParameterWithNullableTypeDeclarationRule.md b/tools/.phpstan/vendor/ergebnis/phpstan-rules/doc/rules/ArrowFunctions/NoParameterWithNullableTypeDeclarationRule.md new file mode 100644 index 000000000..dc1670369 --- /dev/null +++ b/tools/.phpstan/vendor/ergebnis/phpstan-rules/doc/rules/ArrowFunctions/NoParameterWithNullableTypeDeclarationRule.md @@ -0,0 +1,51 @@ +# `ArrowFunctions\NoParameterWithNullableTypeDeclarationRule` + +This rule reports an error when an arrow function has a parameter with a nullable type declaration. + +## Rationale + +A parameter with a nullable type declaration makes the arrow function handle two cases: a value and `null`. Separate arrow functions or a null object make each case explicit. + +## Examples + +### Reported + +```php + \strtoupper((string) $value); +``` + +### Not reported + +```php + \strtoupper($value); +``` + +## Parameters + +### `enabled` + +By default, this rule is enabled, unless you set the [`allRules`](../../../README.md#disabling-all-rules) parameter to `false`. + +You can set the `enabled` parameter to `false` to disable this rule. + +```neon +parameters: + ergebnis: + noParameterWithNullableTypeDeclaration: + enabled: false +``` + +πŸ’‘ The `enabled` parameter for `noParameterWithNullableTypeDeclaration` also enables or disables the following rules: + +- [`Closures\NoParameterWithNullableTypeDeclarationRule`](../../../doc/rules/Closures/NoParameterWithNullableTypeDeclarationRule.md) +- [`Functions\NoParameterWithNullableTypeDeclarationRule`](../../../doc/rules/Functions/NoParameterWithNullableTypeDeclarationRule.md) +- [`Methods\NoParameterWithNullableTypeDeclarationRule`](../../../doc/rules/Methods/NoParameterWithNullableTypeDeclarationRule.md) +- [`PropertyHooks\NoParameterWithNullableTypeDeclarationRule`](../../../doc/rules/PropertyHooks/NoParameterWithNullableTypeDeclarationRule.md) diff --git a/tools/.phpstan/vendor/ergebnis/phpstan-rules/doc/rules/CallLikes/NoNamedArgumentRule.md b/tools/.phpstan/vendor/ergebnis/phpstan-rules/doc/rules/CallLikes/NoNamedArgumentRule.md new file mode 100644 index 000000000..a990ede3b --- /dev/null +++ b/tools/.phpstan/vendor/ergebnis/phpstan-rules/doc/rules/CallLikes/NoNamedArgumentRule.md @@ -0,0 +1,60 @@ +# `CallLikes\NoNamedArgumentRule` + +This rule reports an error when an anonymous function, a function, or a method is invoked using a [named argument](https://www.php.net/manual/en/functions.arguments.php#functions.named-arguments). + +## Rationale + +Named arguments make the names of parameters part of the public API, so renaming a parameter breaks callers. Positional arguments keep the names of parameters an implementation detail. + +## Examples + +### Reported + +```php + $name, +]; +``` + +## Parameters + +### `enabled` + +By default, this rule is enabled, unless you set the [`allRules`](../../../README.md#disabling-all-rules) parameter to `false`. + +You can set the `enabled` parameter to `false` to disable this rule. + +```neon +parameters: + ergebnis: + noCompact: + enabled: false +``` diff --git a/tools/.phpstan/vendor/ergebnis/phpstan-rules/doc/rules/Expressions/NoErrorSuppressionRule.md b/tools/.phpstan/vendor/ergebnis/phpstan-rules/doc/rules/Expressions/NoErrorSuppressionRule.md new file mode 100644 index 000000000..2449cfd1d --- /dev/null +++ b/tools/.phpstan/vendor/ergebnis/phpstan-rules/doc/rules/Expressions/NoErrorSuppressionRule.md @@ -0,0 +1,48 @@ +# `Expressions\NoErrorSuppressionRule` + +This rule reports an error when [`@`](https://www.php.net/manual/en/language.operators.errorcontrol.php) is used to suppress errors. + +## Rationale + +The error control operator hides every error that the expression causes, including errors you did not expect. Check for the error condition explicitly instead. + +## Examples + +### Reported + +```php + 'Jane', +]; + +if (isset($values['name'])) { + echo $values['name']; +} +``` + +### Not reported + +```php + 'Jane', +]; + +if (\array_key_exists('name', $values)) { + echo $values['name']; +} +``` + +## Parameters + +### `enabled` + +By default, this rule is enabled, unless you set the [`allRules`](../../../README.md#disabling-all-rules) parameter to `false`. + +You can set the `enabled` parameter to `false` to disable this rule. + +```neon +parameters: + ergebnis: + noIsset: + enabled: false +``` diff --git a/tools/.phpstan/vendor/ergebnis/phpstan-rules/doc/rules/Files/DeclareStrictTypesRule.md b/tools/.phpstan/vendor/ergebnis/phpstan-rules/doc/rules/Files/DeclareStrictTypesRule.md new file mode 100644 index 000000000..2a18c9572 --- /dev/null +++ b/tools/.phpstan/vendor/ergebnis/phpstan-rules/doc/rules/Files/DeclareStrictTypesRule.md @@ -0,0 +1,42 @@ +# `Files\DeclareStrictTypesRule` + +This rule reports an error when a non-empty file does not contain a `declare(strict_types=1)` declaration. + +## Rationale + +Without a `declare(strict_types=1)` declaration, PHP coerces scalar arguments and return values to the declared types, which hides type errors. + +## Examples + +### Reported + +```php +salutation = $salutation; + } +} +``` + +### Not reported + +```php +salutation = $salutation; + } +} +``` + +## Parameters + +### `enabled` + +By default, this rule is enabled, unless you set the [`allRules`](../../../README.md#disabling-all-rules) parameter to `false`. + +You can set the `enabled` parameter to `false` to disable this rule. + +```neon +parameters: + ergebnis: + noConstructorParameterWithDefaultValue: + enabled: false +``` diff --git a/tools/.phpstan/vendor/ergebnis/phpstan-rules/doc/rules/Methods/NoNullableReturnTypeDeclarationRule.md b/tools/.phpstan/vendor/ergebnis/phpstan-rules/doc/rules/Methods/NoNullableReturnTypeDeclarationRule.md new file mode 100644 index 000000000..b10c01bf2 --- /dev/null +++ b/tools/.phpstan/vendor/ergebnis/phpstan-rules/doc/rules/Methods/NoNullableReturnTypeDeclarationRule.md @@ -0,0 +1,72 @@ +# `Methods\NoNullableReturnTypeDeclarationRule` + +This rule reports an error when a method uses a nullable return type declaration. + +## Rationale + +A nullable return type forces every caller to handle `null`. Throwing an exception, returning a null object, or splitting the method in two keeps the callers simpler. + +## Examples + +### Reported + +```php +get('salutation'); + } +} +``` + +### Not reported + +```php +toString(); + } +} +``` + +## Parameters + +### `enabled` + +By default, this rule is enabled, unless you set the [`allRules`](../../../README.md#disabling-all-rules) parameter to `false`. + +You can set the `enabled` parameter to `false` to disable this rule. + +```neon +parameters: + ergebnis: + noParameterWithContainerTypeDeclaration: + enabled: false +``` + +### `interfacesImplementedByContainers` + +By default, this rule disallows the use of type declarations indicating an implementation of + +- [`Psr\Container\ContainerInterface`](https://github.com/php-fig/container/blob/1.0.0/src/ContainerInterface.php) + +is expected to be injected into a method. + +You can set the `interfacesImplementedByContainers` parameter to a list of interface names of additional containers and service locators. + +Default value: `[Psr\Container\ContainerInterface]` + +Example: + +```neon +parameters: + ergebnis: + noParameterWithContainerTypeDeclaration: + interfacesImplementedByContainers: + - Fancy\DependencyInjection\ContainerInterface + - Other\ServiceLocatorInterface +``` + +### `methodsAllowedToUseContainerTypeDeclarations` + +You can set the `methodsAllowedToUseContainerTypeDeclarations` parameter to a list of method names that are allowed to use parameters with container type declarations. + +Default value: `[]` + +Example: + +```neon +parameters: + ergebnis: + noParameterWithContainerTypeDeclaration: + methodsAllowedToUseContainerTypeDeclarations: + - loadExtension +``` diff --git a/tools/.phpstan/vendor/ergebnis/phpstan-rules/doc/rules/Methods/NoParameterWithNullDefaultValueRule.md b/tools/.phpstan/vendor/ergebnis/phpstan-rules/doc/rules/Methods/NoParameterWithNullDefaultValueRule.md new file mode 100644 index 000000000..e00fccd97 --- /dev/null +++ b/tools/.phpstan/vendor/ergebnis/phpstan-rules/doc/rules/Methods/NoParameterWithNullDefaultValueRule.md @@ -0,0 +1,72 @@ +# `Methods\NoParameterWithNullDefaultValueRule` + +This rule reports an error when a method has a parameter with `null` as default value. + +## Rationale + +A parameter with `null` as its default value makes the argument optional and nullable at once, so the method has to handle a missing value. Separate methods or a null object make each case explicit. + +## Examples + +### Reported + +```php +values; + } +} +``` + +### Not reported + +```php +values; + } +} +``` + +## Parameters + +### `enabled` + +By default, this rule is enabled, unless you set the [`allRules`](../../../README.md#disabling-all-rules) parameter to `false`. + +You can set the `enabled` parameter to `false` to disable this rule. + +```neon +parameters: + ergebnis: + noReturnByReference: + enabled: false +``` + +πŸ’‘ The `enabled` parameter for `noReturnByReference` also enables or disables the following rules: + +- [`Functions\NoReturnByReferenceRule`](../../../doc/rules/Functions/NoReturnByReferenceRule.md) +- [`PropertyHooks\NoReturnByReferenceRule`](../../../doc/rules/PropertyHooks/NoReturnByReferenceRule.md) diff --git a/tools/.phpstan/vendor/ergebnis/phpstan-rules/doc/rules/Methods/PrivateInFinalClassRule.md b/tools/.phpstan/vendor/ergebnis/phpstan-rules/doc/rules/Methods/PrivateInFinalClassRule.md new file mode 100644 index 000000000..d3ffdd3eb --- /dev/null +++ b/tools/.phpstan/vendor/ergebnis/phpstan-rules/doc/rules/Methods/PrivateInFinalClassRule.md @@ -0,0 +1,60 @@ +# `Methods\PrivateInFinalClassRule` + +This rule reports an error when a method in a `final` class is `protected` but could be `private`. + +## Rationale + +A `final` class cannot be extended, so a `protected` method in it can only be used like a `private` method. Declaring the method `private` makes that explicit. + +## Examples + +### Reported + +```php +salutation = (string) $value; + } + } +} +``` + +### Not reported + +```php +salutation = $value; + } + } +} +``` + +## Parameters + +### `enabled` + +By default, this rule is enabled, unless you set the [`allRules`](../../../README.md#disabling-all-rules) parameter to `false`. + +You can set the `enabled` parameter to `false` to disable this rule. + +```neon +parameters: + ergebnis: + noParameterWithNullableTypeDeclaration: + enabled: false +``` + +πŸ’‘ The `enabled` parameter for `noParameterWithNullableTypeDeclaration` also enables or disables the following rules: + +- [`ArrowFunctions\NoParameterWithNullableTypeDeclarationRule`](../../../doc/rules/ArrowFunctions/NoParameterWithNullableTypeDeclarationRule.md) +- [`Closures\NoParameterWithNullableTypeDeclarationRule`](../../../doc/rules/Closures/NoParameterWithNullableTypeDeclarationRule.md) +- [`Functions\NoParameterWithNullableTypeDeclarationRule`](../../../doc/rules/Functions/NoParameterWithNullableTypeDeclarationRule.md) +- [`Methods\NoParameterWithNullableTypeDeclarationRule`](../../../doc/rules/Methods/NoParameterWithNullableTypeDeclarationRule.md) diff --git a/tools/.phpstan/vendor/ergebnis/phpstan-rules/doc/rules/PropertyHooks/NoReturnByReferenceRule.md b/tools/.phpstan/vendor/ergebnis/phpstan-rules/doc/rules/PropertyHooks/NoReturnByReferenceRule.md new file mode 100644 index 000000000..8f04ca70c --- /dev/null +++ b/tools/.phpstan/vendor/ergebnis/phpstan-rules/doc/rules/PropertyHooks/NoReturnByReferenceRule.md @@ -0,0 +1,67 @@ +# `PropertyHooks\NoReturnByReferenceRule` + +This rule reports an error when a [property hook](https://www.php.net/manual/en/language.oop5.property-hooks.php) returns by reference. + +## Rationale + +Returning by reference lets the caller change state that the property hook keeps, which makes the code harder to follow. Return a value instead. + +## Examples + +### Reported + +```php + $this->values; + } +} +``` + +### Not reported + +```php + $this->values; + } +} +``` + +## Parameters + +### `enabled` + +By default, this rule is enabled, unless you set the [`allRules`](../../../README.md#disabling-all-rules) parameter to `false`. + +You can set the `enabled` parameter to `false` to disable this rule. + +```neon +parameters: + ergebnis: + noReturnByReference: + enabled: false +``` + +πŸ’‘ The `enabled` parameter for `noReturnByReference` also enables or disables the following rules: + +- [`Functions\NoReturnByReferenceRule`](../../../doc/rules/Functions/NoReturnByReferenceRule.md) +- [`Methods\NoReturnByReferenceRule`](../../../doc/rules/Methods/NoReturnByReferenceRule.md) diff --git a/tools/.phpstan/vendor/ergebnis/phpstan-rules/doc/rules/Statements/NoSwitchRule.md b/tools/.phpstan/vendor/ergebnis/phpstan-rules/doc/rules/Statements/NoSwitchRule.md new file mode 100644 index 000000000..9b374e6c9 --- /dev/null +++ b/tools/.phpstan/vendor/ergebnis/phpstan-rules/doc/rules/Statements/NoSwitchRule.md @@ -0,0 +1,60 @@ +# `Statements\NoSwitchRule` + +This rule reports an error when the statement [`switch()`](https://www.php.net/manual/control-structures.switch.php) is used. + +## Rationale + +A `switch` statement compares loosely and falls through to the next case without `break`, which can cause subtle bugs. Use `if` statements or `match` instead. + +## Examples + +### Reported + +```php + + */ +final class NoNullableReturnTypeDeclarationRule implements + Documentation\HasRuleDefinition, + Rules\Rule +{ + private Analyzer $analyzer; + + public function __construct(Analyzer $analyzer) + { + $this->analyzer = $analyzer; + } + + public function ruleDefinition(): Documentation\RuleDefinition + { + return Documentation\RuleDefinition::create( + 'noNullableReturnTypeDeclaration', + 'This rule reports an error when an arrow function uses a nullable return type declaration.', + 'A nullable return type forces every caller to handle `null`. Throwing an exception, returning a null object, or splitting the arrow function in two keeps the callers simpler.', + 'Throw an exception, return a null object, or split the arrow function in two instead.', + )->withCodeSamples( + Documentation\CodeSample::reported(<<<'PHP' + \strtoupper($value); + PHP), + Documentation\CodeSample::notReported(<<<'PHP' + \strtoupper($value); + PHP), + ); + } + + public function getNodeType(): string + { + return Node\Expr\ArrowFunction::class; + } + + public function processNode( + Node $node, + Analyser\Scope $scope + ): array { + if (!$this->analyzer->isNullableTypeDeclaration($node->getReturnType())) { + return []; + } + + return [ + Rules\RuleErrorBuilder::message('Arrow function has a nullable return type declaration.') + ->identifier(ErrorIdentifier::noNullableReturnTypeDeclaration()->toString()) + ->tip(Documentation\ErrorTip::for($this)) + ->build(), + ]; + } +} diff --git a/tools/.phpstan/vendor/ergebnis/phpstan-rules/src/ArrowFunctions/NoParameterPassedByReferenceRule.php b/tools/.phpstan/vendor/ergebnis/phpstan-rules/src/ArrowFunctions/NoParameterPassedByReferenceRule.php new file mode 100644 index 000000000..5e33a20c2 --- /dev/null +++ b/tools/.phpstan/vendor/ergebnis/phpstan-rules/src/ArrowFunctions/NoParameterPassedByReferenceRule.php @@ -0,0 +1,93 @@ + + */ +final class NoParameterPassedByReferenceRule implements + Documentation\HasRuleDefinition, + Rules\Rule +{ + public function ruleDefinition(): Documentation\RuleDefinition + { + return Documentation\RuleDefinition::create( + 'noParameterPassedByReference', + 'This rule reports an error when an arrow function has a parameter that is [passed by reference](https://www.php.net/manual/en/language.references.pass.php).', + 'A parameter passed by reference lets an arrow function change a variable of its caller as a side effect, which makes the code harder to follow. Return the new value instead.', + 'Return the new value instead.', + )->withCodeSamples( + Documentation\CodeSample::reported(<<<'PHP' + $value + 1; + PHP), + Documentation\CodeSample::notReported(<<<'PHP' + $value + 1; + PHP), + ); + } + + public function getNodeType(): string + { + return Node\Expr\ArrowFunction::class; + } + + public function processNode( + Node $node, + Analyser\Scope $scope + ): array { + if (0 === \count($node->params)) { + return []; + } + + $parametersPassedByReference = \array_values(\array_filter($node->params, static function (Node\Param $parameter): bool { + return $parameter->byRef; + })); + + if (0 === \count($parametersPassedByReference)) { + return []; + } + + return \array_map(function (Node\Param $parameterPassedByReference): Rules\RuleError { + /** @var Node\Expr\Variable $variable */ + $variable = $parameterPassedByReference->var; + + /** @var string $parameterName */ + $parameterName = $variable->name; + + $message = \sprintf( + 'Arrow function has parameter $%s that is passed by reference.', + $parameterName, + ); + + return Rules\RuleErrorBuilder::message($message) + ->identifier(ErrorIdentifier::noParameterPassedByReference()->toString()) + ->tip(Documentation\ErrorTip::for($this)) + ->build(); + }, $parametersPassedByReference); + } +} diff --git a/tools/.phpstan/vendor/ergebnis/phpstan-rules/src/ArrowFunctions/NoParameterWithNullDefaultValueRule.php b/tools/.phpstan/vendor/ergebnis/phpstan-rules/src/ArrowFunctions/NoParameterWithNullDefaultValueRule.php new file mode 100644 index 000000000..1f02ee996 --- /dev/null +++ b/tools/.phpstan/vendor/ergebnis/phpstan-rules/src/ArrowFunctions/NoParameterWithNullDefaultValueRule.php @@ -0,0 +1,101 @@ + + */ +final class NoParameterWithNullDefaultValueRule implements + Documentation\HasRuleDefinition, + Rules\Rule +{ + private Analyzer $analyzer; + + public function __construct(Analyzer $analyzer) + { + $this->analyzer = $analyzer; + } + + public function ruleDefinition(): Documentation\RuleDefinition + { + return Documentation\RuleDefinition::create( + 'noParameterWithNullDefaultValue', + 'This rule reports an error when an arrow function has a parameter with `null` as default value.', + 'A parameter with `null` as its default value makes the argument optional and nullable at once, so the arrow function has to handle a missing value. Separate arrow functions or a null object make each case explicit.', + 'Use separate arrow functions or a null object instead.', + )->withCodeSamples( + Documentation\CodeSample::reported(<<<'PHP' + \strtoupper((string) $value); + PHP), + Documentation\CodeSample::notReported(<<<'PHP' + \strtoupper($value); + PHP), + ); + } + + public function getNodeType(): string + { + return Node\Expr\ArrowFunction::class; + } + + public function processNode( + Node $node, + Analyser\Scope $scope + ): array { + if (0 === \count($node->params)) { + return []; + } + + $parametersWithNullDefaultValue = \array_values(\array_filter($node->params, function (Node\Param $parameter): bool { + return $this->analyzer->hasNullDefaultValue($parameter); + })); + + if (0 === \count($parametersWithNullDefaultValue)) { + return []; + } + + return \array_map(function (Node\Param $parameterWithNullDefaultValue): Rules\RuleError { + /** @var Node\Expr\Variable $variable */ + $variable = $parameterWithNullDefaultValue->var; + + /** @var string $parameterName */ + $parameterName = $variable->name; + + $message = \sprintf( + 'Arrow function has parameter $%s with null as default value.', + $parameterName, + ); + + return Rules\RuleErrorBuilder::message($message) + ->identifier(ErrorIdentifier::noParameterWithNullDefaultValue()->toString()) + ->tip(Documentation\ErrorTip::for($this)) + ->build(); + }, $parametersWithNullDefaultValue); + } +} diff --git a/tools/.phpstan/vendor/ergebnis/phpstan-rules/src/ArrowFunctions/NoParameterWithNullableTypeDeclarationRule.php b/tools/.phpstan/vendor/ergebnis/phpstan-rules/src/ArrowFunctions/NoParameterWithNullableTypeDeclarationRule.php new file mode 100644 index 000000000..f9d96b56b --- /dev/null +++ b/tools/.phpstan/vendor/ergebnis/phpstan-rules/src/ArrowFunctions/NoParameterWithNullableTypeDeclarationRule.php @@ -0,0 +1,101 @@ + + */ +final class NoParameterWithNullableTypeDeclarationRule implements + Documentation\HasRuleDefinition, + Rules\Rule +{ + private Analyzer $analyzer; + + public function __construct(Analyzer $analyzer) + { + $this->analyzer = $analyzer; + } + + public function ruleDefinition(): Documentation\RuleDefinition + { + return Documentation\RuleDefinition::create( + 'noParameterWithNullableTypeDeclaration', + 'This rule reports an error when an arrow function has a parameter with a nullable type declaration.', + 'A parameter with a nullable type declaration makes the arrow function handle two cases: a value and `null`. Separate arrow functions or a null object make each case explicit.', + 'Use separate arrow functions or a null object instead.', + )->withCodeSamples( + Documentation\CodeSample::reported(<<<'PHP' + \strtoupper((string) $value); + PHP), + Documentation\CodeSample::notReported(<<<'PHP' + \strtoupper($value); + PHP), + ); + } + + public function getNodeType(): string + { + return Node\Expr\ArrowFunction::class; + } + + public function processNode( + Node $node, + Analyser\Scope $scope + ): array { + if (0 === \count($node->params)) { + return []; + } + + $parametersWithNullableTypeDeclaration = \array_values(\array_filter($node->params, function (Node\Param $parameter): bool { + return $this->analyzer->isNullableTypeDeclaration($parameter->type); + })); + + if (0 === \count($parametersWithNullableTypeDeclaration)) { + return []; + } + + return \array_map(function (Node\Param $parameterWithNullableTypeDeclaration): Rules\RuleError { + /** @var Node\Expr\Variable $variable */ + $variable = $parameterWithNullableTypeDeclaration->var; + + /** @var string $parameterName */ + $parameterName = $variable->name; + + $message = \sprintf( + 'Arrow function has parameter $%s with a nullable type declaration.', + $parameterName, + ); + + return Rules\RuleErrorBuilder::message($message) + ->identifier(ErrorIdentifier::noParameterWithNullableTypeDeclaration()->toString()) + ->tip(Documentation\ErrorTip::for($this)) + ->build(); + }, $parametersWithNullableTypeDeclaration); + } +} diff --git a/tools/.phpstan/vendor/ergebnis/phpstan-rules/src/CallLikes/NoNamedArgumentRule.php b/tools/.phpstan/vendor/ergebnis/phpstan-rules/src/CallLikes/NoNamedArgumentRule.php index d76397efa..88738960b 100644 --- a/tools/.phpstan/vendor/ergebnis/phpstan-rules/src/CallLikes/NoNamedArgumentRule.php +++ b/tools/.phpstan/vendor/ergebnis/phpstan-rules/src/CallLikes/NoNamedArgumentRule.php @@ -13,17 +13,60 @@ namespace Ergebnis\PHPStan\Rules\CallLikes; +use Ergebnis\PHPStan\Rules\Documentation; use Ergebnis\PHPStan\Rules\ErrorIdentifier; use PhpParser\Node; use PHPStan\Analyser; use PHPStan\Rules; -use PHPStan\ShouldNotHappenException; /** * @implements Rules\Rule */ -final class NoNamedArgumentRule implements Rules\Rule +final class NoNamedArgumentRule implements + Documentation\HasRuleDefinition, + Rules\Rule { + public function ruleDefinition(): Documentation\RuleDefinition + { + return Documentation\RuleDefinition::create( + 'noNamedArgument', + 'This rule reports an error when an anonymous function, a function, or a method is invoked using a [named argument](https://www.php.net/manual/en/functions.arguments.php#functions.named-arguments).', + 'Named arguments make the names of parameters part of the public API, so renaming a parameter breaks callers. Positional arguments keep the names of parameters an implementation detail.', + 'Use positional arguments instead.', + )->withCodeSamples( + Documentation\CodeSample::reported(<<<'PHP' + name; @@ -67,6 +110,7 @@ public function processNode( return Rules\RuleErrorBuilder::message($message) ->identifier(ErrorIdentifier::noNamedArgument()->toString()) + ->tip(Documentation\ErrorTip::for($this)) ->build(); }, $namedArguments); } @@ -112,7 +156,20 @@ private static function describeCallLike( ); if (null === $methodReflection) { - throw new ShouldNotHappenException(); + $objectClassNames = $objectType->getObjectClassNames(); + + if (1 === \count($objectClassNames)) { + return \sprintf( + 'Method %s::%s()', + $objectClassNames[0], + $methodName->toString(), + ); + } + + return \sprintf( + 'Method %s()', + $methodName->toString(), + ); } $declaringClass = $methodReflection->getDeclaringClass(); diff --git a/tools/.phpstan/vendor/ergebnis/phpstan-rules/src/Classes/FinalRule.php b/tools/.phpstan/vendor/ergebnis/phpstan-rules/src/Classes/FinalRule.php index 7deed487a..dd01fe7ed 100644 --- a/tools/.phpstan/vendor/ergebnis/phpstan-rules/src/Classes/FinalRule.php +++ b/tools/.phpstan/vendor/ergebnis/phpstan-rules/src/Classes/FinalRule.php @@ -14,6 +14,7 @@ namespace Ergebnis\PHPStan\Rules\Classes; use Doctrine\ORM; +use Ergebnis\PHPStan\Rules\Documentation; use Ergebnis\PHPStan\Rules\ErrorIdentifier; use PhpParser\Comment; use PhpParser\Node; @@ -23,7 +24,9 @@ /** * @implements Rules\Rule */ -final class FinalRule implements Rules\Rule +final class FinalRule implements + Documentation\HasRuleDefinition, + Rules\Rule { /** * @var list @@ -41,6 +44,7 @@ final class FinalRule implements Rules\Rule ORM\Mapping\Entity::class, ]; private bool $allowAbstractClasses; + private bool $ignoreDoctrineEntities; /** * @var list @@ -53,9 +57,11 @@ final class FinalRule implements Rules\Rule */ public function __construct( bool $allowAbstractClasses, - array $classesNotRequiredToBeAbstractOrFinal + array $classesNotRequiredToBeAbstractOrFinal, + bool $ignoreDoctrineEntities ) { $this->allowAbstractClasses = $allowAbstractClasses; + $this->ignoreDoctrineEntities = $ignoreDoctrineEntities; $this->classesNotRequiredToBeAbstractOrFinal = \array_map(static function (string $classNotRequiredToBeAbstractOrFinal): string { return $classNotRequiredToBeAbstractOrFinal; }, $classesNotRequiredToBeAbstractOrFinal); @@ -65,6 +71,74 @@ public function __construct( } } + public function ruleDefinition(): Documentation\RuleDefinition + { + return Documentation\RuleDefinition::create( + 'final', + <<<'MARKDOWN' + This rule reports an error when a non-anonymous class is not `final`. + + πŸ’‘ By default, this rule ignores classes that + + - use `@Entity`, `@ORM\Entity`, or `@ORM\Mapping\Entity` annotations + - use `Doctrine\ORM\Mapping\Entity` attributes + + on the class level. + MARKDOWN, + 'A class that is not `final` can be extended, so every change to it can break a subclass. Declare classes `final` and prefer composition over inheritance.', + 'Declare the class `final` and prefer composition over inheritance.', + Documentation\Parameter::create( + 'allowAbstractClasses', + <<<'MARKDOWN' + By default, this rule allows to declare `abstract` classes. + + You can set the `allowAbstractClasses` parameter to `false` to disallow abstract classes. + MARKDOWN, + false, + ), + Documentation\Parameter::create( + 'classesNotRequiredToBeAbstractOrFinal', + 'You can set the `classesNotRequiredToBeAbstractOrFinal` parameter to a list of class names that you want to exclude from inspection.', + [ + 'Foo\\Bar\\NeitherAbstractNorFinal', + 'Bar\\Baz\\NeitherAbstractNorFinal', + ], + ), + Documentation\Parameter::create( + 'ignoreDoctrineEntities', + <<<'MARKDOWN' + By default, this rule ignores Doctrine entities, because Doctrine creates proxies for lazy loading by extending them. + + When you use [native lazy objects](https://github.com/doctrine/orm/pull/11853) with `doctrine/orm:^3.4.0` on PHP 8.4 or later, Doctrine no longer extends entities, and you can set the `ignoreDoctrineEntities` parameter to `false` to require Doctrine entities to be `final` as well. + MARKDOWN, + false, + ), + )->withCodeSamples( + Documentation\CodeSample::reported(<<<'PHP' + ignoreDoctrineEntities + && self::hasWhitelistedAnnotation($node) + ) { return []; } - if (self::hasWhitelistedAttribute($node)) { + if ( + $this->ignoreDoctrineEntities + && self::hasWhitelistedAttribute($node) + ) { return []; } @@ -109,6 +189,7 @@ public function processNode( return [ Rules\RuleErrorBuilder::message($message) ->identifier(ErrorIdentifier::final()->toString()) + ->tip(Documentation\ErrorTip::for($this)) ->build(), ]; } diff --git a/tools/.phpstan/vendor/ergebnis/phpstan-rules/src/Classes/NoExtendsRule.php b/tools/.phpstan/vendor/ergebnis/phpstan-rules/src/Classes/NoExtendsRule.php index 7674298f8..3538be7a7 100644 --- a/tools/.phpstan/vendor/ergebnis/phpstan-rules/src/Classes/NoExtendsRule.php +++ b/tools/.phpstan/vendor/ergebnis/phpstan-rules/src/Classes/NoExtendsRule.php @@ -13,6 +13,7 @@ namespace Ergebnis\PHPStan\Rules\Classes; +use Ergebnis\PHPStan\Rules\Documentation; use Ergebnis\PHPStan\Rules\ErrorIdentifier; use PhpParser\Node; use PHPStan\Analyser; @@ -22,7 +23,9 @@ /** * @implements Rules\Rule */ -final class NoExtendsRule implements Rules\Rule +final class NoExtendsRule implements + Documentation\HasRuleDefinition, + Rules\Rule { /** * @var list @@ -50,6 +53,61 @@ public function __construct(array $classesAllowedToBeExtended) ))); } + public function ruleDefinition(): Documentation\RuleDefinition + { + return Documentation\RuleDefinition::create( + 'noExtends', + 'This rule reports an error when a class extends another class.', + 'Extending a class couples the subclass to the implementation of its parent class. Prefer composition: inject collaborators and implement interfaces.', + 'Inject collaborators and implement interfaces instead.', + Documentation\Parameter::create( + 'classesAllowedToBeExtended', + <<<'MARKDOWN' + By default, this rule allows the following classes to be extended: + + - [`PHPUnit\Framework\TestCase`](https://github.com/sebastianbergmann/phpunit/blob/6.0.0/src/Framework/TestCase.php) + + You can set the `classesAllowedToBeExtended` parameter to a list of class names that you want to allow to be extended. + MARKDOWN, + [ + 'Ergebnis\\PHPStan\\Rules\\Test\\Integration\\AbstractTestCase', + 'PHPStan\\Testing\\RuleTestCase', + ], + ), + )->withCodeSamples( + Documentation\CodeSample::reported(<<<'PHP' + identifier(ErrorIdentifier::noExtends()->toString()) + ->tip(Documentation\ErrorTip::for($this)) ->build(), ]; } @@ -93,6 +152,7 @@ public function processNode( return [ Rules\RuleErrorBuilder::message($message) ->identifier(ErrorIdentifier::noExtends()->toString()) + ->tip(Documentation\ErrorTip::for($this)) ->build(), ]; } diff --git a/tools/.phpstan/vendor/ergebnis/phpstan-rules/src/Classes/PHPUnit/Framework/TestCaseWithSuffixRule.php b/tools/.phpstan/vendor/ergebnis/phpstan-rules/src/Classes/PHPUnit/Framework/TestCaseWithSuffixRule.php index 7c1ee5767..993ec7449 100644 --- a/tools/.phpstan/vendor/ergebnis/phpstan-rules/src/Classes/PHPUnit/Framework/TestCaseWithSuffixRule.php +++ b/tools/.phpstan/vendor/ergebnis/phpstan-rules/src/Classes/PHPUnit/Framework/TestCaseWithSuffixRule.php @@ -13,6 +13,7 @@ namespace Ergebnis\PHPStan\Rules\Classes\PHPUnit\Framework; +use Ergebnis\PHPStan\Rules\Documentation; use Ergebnis\PHPStan\Rules\ErrorIdentifier; use PhpParser\Node; use PHPStan\Analyser; @@ -22,7 +23,9 @@ /** * @implements Rules\Rule */ -final class TestCaseWithSuffixRule implements Rules\Rule +final class TestCaseWithSuffixRule implements + Documentation\HasRuleDefinition, + Rules\Rule { /** * @var list @@ -37,6 +40,43 @@ public function __construct(Reflection\ReflectionProvider $reflectionProvider) $this->reflectionProvider = $reflectionProvider; } + public function ruleDefinition(): Documentation\RuleDefinition + { + return Documentation\RuleDefinition::create( + 'testCaseWithSuffix', + 'This rule reports an error when a concrete class is a sub-class of `PHPUnit\\Framework\\TestCase` but does not have a `Test` suffix.', + 'By default, PHPUnit only runs tests from files whose names end with `Test.php`, and the suffix tells readers which classes are tests.', + 'Add the `Test` suffix to the name of the class.', + )->withCodeSamples( + Documentation\CodeSample::reported(<<<'PHP' + identifier(ErrorIdentifier::testCaseWithSuffix()->toString()) + ->tip(Documentation\ErrorTip::for($this)) ->build(), ]; } diff --git a/tools/.phpstan/vendor/ergebnis/phpstan-rules/src/Closures/NoNullableReturnTypeDeclarationRule.php b/tools/.phpstan/vendor/ergebnis/phpstan-rules/src/Closures/NoNullableReturnTypeDeclarationRule.php index cca6f2939..3ef318c70 100644 --- a/tools/.phpstan/vendor/ergebnis/phpstan-rules/src/Closures/NoNullableReturnTypeDeclarationRule.php +++ b/tools/.phpstan/vendor/ergebnis/phpstan-rules/src/Closures/NoNullableReturnTypeDeclarationRule.php @@ -14,6 +14,7 @@ namespace Ergebnis\PHPStan\Rules\Closures; use Ergebnis\PHPStan\Rules\Analyzer; +use Ergebnis\PHPStan\Rules\Documentation; use Ergebnis\PHPStan\Rules\ErrorIdentifier; use PhpParser\Node; use PHPStan\Analyser; @@ -22,7 +23,9 @@ /** * @implements Rules\Rule */ -final class NoNullableReturnTypeDeclarationRule implements Rules\Rule +final class NoNullableReturnTypeDeclarationRule implements + Documentation\HasRuleDefinition, + Rules\Rule { private Analyzer $analyzer; @@ -31,6 +34,35 @@ public function __construct(Analyzer $analyzer) $this->analyzer = $analyzer; } + public function ruleDefinition(): Documentation\RuleDefinition + { + return Documentation\RuleDefinition::create( + 'noNullableReturnTypeDeclaration', + 'This rule reports an error when a closure uses a nullable return type declaration.', + 'A nullable return type forces every caller to handle `null`. Throwing an exception, returning a null object, or splitting the closure in two keeps the callers simpler.', + 'Throw an exception, return a null object, or split the closure in two instead.', + )->withCodeSamples( + Documentation\CodeSample::reported(<<<'PHP' + identifier(ErrorIdentifier::noNullableReturnTypeDeclaration()->toString()) + ->tip(Documentation\ErrorTip::for($this)) ->build(), ]; } diff --git a/tools/.phpstan/vendor/ergebnis/phpstan-rules/src/Closures/NoParameterPassedByReferenceRule.php b/tools/.phpstan/vendor/ergebnis/phpstan-rules/src/Closures/NoParameterPassedByReferenceRule.php index 7a5027eb6..993edcff4 100644 --- a/tools/.phpstan/vendor/ergebnis/phpstan-rules/src/Closures/NoParameterPassedByReferenceRule.php +++ b/tools/.phpstan/vendor/ergebnis/phpstan-rules/src/Closures/NoParameterPassedByReferenceRule.php @@ -13,6 +13,7 @@ namespace Ergebnis\PHPStan\Rules\Closures; +use Ergebnis\PHPStan\Rules\Documentation; use Ergebnis\PHPStan\Rules\ErrorIdentifier; use PhpParser\Node; use PHPStan\Analyser; @@ -21,8 +22,39 @@ /** * @implements Rules\Rule */ -final class NoParameterPassedByReferenceRule implements Rules\Rule +final class NoParameterPassedByReferenceRule implements + Documentation\HasRuleDefinition, + Rules\Rule { + public function ruleDefinition(): Documentation\RuleDefinition + { + return Documentation\RuleDefinition::create( + 'noParameterPassedByReference', + 'This rule reports an error when a closure has a parameter that is [passed by reference](https://www.php.net/manual/en/language.references.pass.php).', + 'A parameter passed by reference lets a closure change a variable of its caller as a side effect, which makes the code harder to follow. Return the new value instead.', + 'Return the new value instead.', + )->withCodeSamples( + Documentation\CodeSample::reported(<<<'PHP' + var; @@ -58,6 +90,7 @@ public function processNode( return Rules\RuleErrorBuilder::message($message) ->identifier(ErrorIdentifier::noParameterPassedByReference()->toString()) + ->tip(Documentation\ErrorTip::for($this)) ->build(); }, $parametersPassedByReference); } diff --git a/tools/.phpstan/vendor/ergebnis/phpstan-rules/src/Closures/NoParameterWithNullDefaultValueRule.php b/tools/.phpstan/vendor/ergebnis/phpstan-rules/src/Closures/NoParameterWithNullDefaultValueRule.php index 0982f9e58..24b35131f 100644 --- a/tools/.phpstan/vendor/ergebnis/phpstan-rules/src/Closures/NoParameterWithNullDefaultValueRule.php +++ b/tools/.phpstan/vendor/ergebnis/phpstan-rules/src/Closures/NoParameterWithNullDefaultValueRule.php @@ -14,6 +14,7 @@ namespace Ergebnis\PHPStan\Rules\Closures; use Ergebnis\PHPStan\Rules\Analyzer; +use Ergebnis\PHPStan\Rules\Documentation; use Ergebnis\PHPStan\Rules\ErrorIdentifier; use PhpParser\Node; use PHPStan\Analyser; @@ -22,7 +23,9 @@ /** * @implements Rules\Rule */ -final class NoParameterWithNullDefaultValueRule implements Rules\Rule +final class NoParameterWithNullDefaultValueRule implements + Documentation\HasRuleDefinition, + Rules\Rule { private Analyzer $analyzer; @@ -31,6 +34,35 @@ public function __construct(Analyzer $analyzer) $this->analyzer = $analyzer; } + public function ruleDefinition(): Documentation\RuleDefinition + { + return Documentation\RuleDefinition::create( + 'noParameterWithNullDefaultValue', + 'This rule reports an error when a closure has a parameter with `null` as default value.', + 'A parameter with `null` as its default value makes the argument optional and nullable at once, so the closure has to handle a missing value. Separate closures or a null object make each case explicit.', + 'Use separate closures or a null object instead.', + )->withCodeSamples( + Documentation\CodeSample::reported(<<<'PHP' + var; @@ -66,6 +98,7 @@ public function processNode( return Rules\RuleErrorBuilder::message($message) ->identifier(ErrorIdentifier::noParameterWithNullDefaultValue()->toString()) + ->tip(Documentation\ErrorTip::for($this)) ->build(); }, $parametersWithNullDefaultValue); } diff --git a/tools/.phpstan/vendor/ergebnis/phpstan-rules/src/Closures/NoParameterWithNullableTypeDeclarationRule.php b/tools/.phpstan/vendor/ergebnis/phpstan-rules/src/Closures/NoParameterWithNullableTypeDeclarationRule.php index b3145193d..22f4ece52 100644 --- a/tools/.phpstan/vendor/ergebnis/phpstan-rules/src/Closures/NoParameterWithNullableTypeDeclarationRule.php +++ b/tools/.phpstan/vendor/ergebnis/phpstan-rules/src/Closures/NoParameterWithNullableTypeDeclarationRule.php @@ -14,6 +14,7 @@ namespace Ergebnis\PHPStan\Rules\Closures; use Ergebnis\PHPStan\Rules\Analyzer; +use Ergebnis\PHPStan\Rules\Documentation; use Ergebnis\PHPStan\Rules\ErrorIdentifier; use PhpParser\Node; use PHPStan\Analyser; @@ -22,7 +23,9 @@ /** * @implements Rules\Rule */ -final class NoParameterWithNullableTypeDeclarationRule implements Rules\Rule +final class NoParameterWithNullableTypeDeclarationRule implements + Documentation\HasRuleDefinition, + Rules\Rule { private Analyzer $analyzer; @@ -31,6 +34,35 @@ public function __construct(Analyzer $analyzer) $this->analyzer = $analyzer; } + public function ruleDefinition(): Documentation\RuleDefinition + { + return Documentation\RuleDefinition::create( + 'noParameterWithNullableTypeDeclaration', + 'This rule reports an error when a closure has a parameter with a nullable type declaration.', + 'A parameter with a nullable type declaration makes the closure handle two cases: a value and `null`. Separate closures or a null object make each case explicit.', + 'Use separate closures or a null object instead.', + )->withCodeSamples( + Documentation\CodeSample::reported(<<<'PHP' + var; @@ -66,6 +98,7 @@ public function processNode( return Rules\RuleErrorBuilder::message($message) ->identifier(ErrorIdentifier::noParameterWithNullableTypeDeclaration()->toString()) + ->tip(Documentation\ErrorTip::for($this)) ->build(); }, $parametersWithNullableTypeDeclaration); } diff --git a/tools/.phpstan/vendor/ergebnis/phpstan-rules/src/Documentation/CodeSample.php b/tools/.phpstan/vendor/ergebnis/phpstan-rules/src/Documentation/CodeSample.php new file mode 100644 index 000000000..0f178ef75 --- /dev/null +++ b/tools/.phpstan/vendor/ergebnis/phpstan-rules/src/Documentation/CodeSample.php @@ -0,0 +1,63 @@ +code = $code; + $this->reported = $reported; + } + + /** + * Creates a code sample for which the rule reports an error. + */ + public static function reported(string $code): self + { + return new self( + $code, + true, + ); + } + + /** + * Creates a code sample for which the rule does not report an error. + */ + public static function notReported(string $code): self + { + return new self( + $code, + false, + ); + } + + public function code(): string + { + return $this->code; + } + + public function isReported(): bool + { + return $this->reported; + } +} diff --git a/tools/.phpstan/vendor/ergebnis/phpstan-rules/src/Documentation/ErrorTip.php b/tools/.phpstan/vendor/ergebnis/phpstan-rules/src/Documentation/ErrorTip.php new file mode 100644 index 000000000..6ed46c567 --- /dev/null +++ b/tools/.phpstan/vendor/ergebnis/phpstan-rules/src/Documentation/ErrorTip.php @@ -0,0 +1,79 @@ +ruleDefinition()->tip(), + ), + self::installedReference(), + \str_replace( + '\\', + '/', + \mb_substr( + \get_class($rule), + \mb_strlen(self::NAMESPACE_PREFIX), + ), + ), + ); + } + + /** + * Returns the tag of the installed release, or the commit of an installed development version, or main when neither is known. + */ + private static function installedReference(): string + { + if (!InstalledVersions::isInstalled(self::PACKAGE_NAME)) { + return 'main'; + } + + $version = InstalledVersions::getPrettyVersion(self::PACKAGE_NAME); + + if ( + \is_string($version) + && 1 === \preg_match('/^\d+\.\d+\.\d+$/', $version) + ) { + return $version; + } + + $reference = InstalledVersions::getReference(self::PACKAGE_NAME); + + if ( + \is_string($reference) + && '' !== $reference + ) { + return $reference; + } + + return 'main'; + } +} diff --git a/tools/.phpstan/vendor/ergebnis/phpstan-rules/src/Documentation/HasRuleDefinition.php b/tools/.phpstan/vendor/ergebnis/phpstan-rules/src/Documentation/HasRuleDefinition.php new file mode 100644 index 000000000..db3843504 --- /dev/null +++ b/tools/.phpstan/vendor/ergebnis/phpstan-rules/src/Documentation/HasRuleDefinition.php @@ -0,0 +1,22 @@ +>|list + */ + private $example; + + /** + * @param bool|list>|list $example + */ + private function __construct( + string $name, + string $description, + $example + ) { + $this->name = $name; + $this->description = $description; + $this->example = $example; + } + + /** + * @param bool|list>|list $example + */ + public static function create( + string $name, + string $description, + $example + ): self { + return new self( + $name, + $description, + $example, + ); + } + + public function name(): string + { + return $this->name; + } + + /** + * Returns a description of the parameter, in Markdown. + */ + public function description(): string + { + return $this->description; + } + + /** + * Returns an example value for the parameter. + * + * @return bool|list>|list + */ + public function example() + { + return $this->example; + } +} diff --git a/tools/.phpstan/vendor/ergebnis/phpstan-rules/src/Documentation/RuleDefinition.php b/tools/.phpstan/vendor/ergebnis/phpstan-rules/src/Documentation/RuleDefinition.php new file mode 100644 index 000000000..712e26a12 --- /dev/null +++ b/tools/.phpstan/vendor/ergebnis/phpstan-rules/src/Documentation/RuleDefinition.php @@ -0,0 +1,139 @@ + + */ + private array $parameters; + + /** + * @var list + */ + private array $codeSamples; + + /** + * @param list $parameters + * @param list $codeSamples + */ + private function __construct( + string $configurationKey, + string $description, + string $rationale, + string $tip, + array $parameters, + array $codeSamples + ) { + $this->configurationKey = $configurationKey; + $this->description = $description; + $this->rationale = $rationale; + $this->tip = $tip; + $this->parameters = $parameters; + $this->codeSamples = $codeSamples; + } + + public static function create( + string $configurationKey, + string $description, + string $rationale, + string $tip, + Parameter ...$parameters + ): self { + return new self( + $configurationKey, + $description, + $rationale, + $tip, + \array_values($parameters), + [], + ); + } + + /** + * Returns a copy of the rule definition with the code samples. + */ + public function withCodeSamples(CodeSample ...$codeSamples): self + { + return new self( + $this->configurationKey, + $this->description, + $this->rationale, + $this->tip, + $this->parameters, + \array_values($codeSamples), + ); + } + + /** + * Returns the key below parameters.ergebnis that holds the configuration of the rule. + */ + public function configurationKey(): string + { + return $this->configurationKey; + } + + /** + * Returns a description of the rule, in Markdown. + */ + public function description(): string + { + return $this->description; + } + + /** + * Returns the reason for the rule, in Markdown. + */ + public function rationale(): string + { + return $this->rationale; + } + + /** + * Returns a short instruction for fixing errors reported by the rule, in Markdown that uses only backticks, so that it can also be shown as a tip for these errors. + */ + public function tip(): string + { + return $this->tip; + } + + /** + * Returns the parameters for configuring the rule, other than the enabled parameter that every rule has. + * + * @return list + */ + public function parameters(): array + { + return $this->parameters; + } + + /** + * Returns code samples for which the rule reports or does not report an error. + * + * @return list + */ + public function codeSamples(): array + { + return $this->codeSamples; + } +} diff --git a/tools/.phpstan/vendor/ergebnis/phpstan-rules/src/Expressions/NoAssignByReferenceRule.php b/tools/.phpstan/vendor/ergebnis/phpstan-rules/src/Expressions/NoAssignByReferenceRule.php index 9f1f09c58..ddf5e574b 100644 --- a/tools/.phpstan/vendor/ergebnis/phpstan-rules/src/Expressions/NoAssignByReferenceRule.php +++ b/tools/.phpstan/vendor/ergebnis/phpstan-rules/src/Expressions/NoAssignByReferenceRule.php @@ -13,6 +13,7 @@ namespace Ergebnis\PHPStan\Rules\Expressions; +use Ergebnis\PHPStan\Rules\Documentation; use Ergebnis\PHPStan\Rules\ErrorIdentifier; use PhpParser\Node; use PHPStan\Analyser; @@ -21,8 +22,43 @@ /** * @implements Rules\Rule */ -final class NoAssignByReferenceRule implements Rules\Rule +final class NoAssignByReferenceRule implements + Documentation\HasRuleDefinition, + Rules\Rule { + public function ruleDefinition(): Documentation\RuleDefinition + { + return Documentation\RuleDefinition::create( + 'noAssignByReference', + 'This rule reports an error when [a variable is assigned by reference](https://www.php.net/manual/en/language.references.whatdo.php#language.references.whatdo.assign).', + 'Assigning by reference makes two variables share one value, so changing one changes the other, which makes the code harder to follow.', + 'Assign the value instead.', + )->withCodeSamples( + Documentation\CodeSample::reported(<<<'PHP' + identifier(ErrorIdentifier::noAssignByReference()->toString()) + ->tip(Documentation\ErrorTip::for($this)) ->build(), ]; } diff --git a/tools/.phpstan/vendor/ergebnis/phpstan-rules/src/Expressions/NoCompactRule.php b/tools/.phpstan/vendor/ergebnis/phpstan-rules/src/Expressions/NoCompactRule.php index 0374f3a46..1b7e95d36 100644 --- a/tools/.phpstan/vendor/ergebnis/phpstan-rules/src/Expressions/NoCompactRule.php +++ b/tools/.phpstan/vendor/ergebnis/phpstan-rules/src/Expressions/NoCompactRule.php @@ -13,6 +13,7 @@ namespace Ergebnis\PHPStan\Rules\Expressions; +use Ergebnis\PHPStan\Rules\Documentation; use Ergebnis\PHPStan\Rules\ErrorIdentifier; use PhpParser\Node; use PHPStan\Analyser; @@ -21,8 +22,41 @@ /** * @implements Rules\Rule */ -final class NoCompactRule implements Rules\Rule +final class NoCompactRule implements + Documentation\HasRuleDefinition, + Rules\Rule { + public function ruleDefinition(): Documentation\RuleDefinition + { + return Documentation\RuleDefinition::create( + 'noCompact', + 'This rule reports an error when the function [`compact()`](https://www.php.net/compact) is used.', + 'The function `compact()` refers to variables by their names in strings, which static analysis and automated refactoring cannot follow. Build the array explicitly instead.', + 'Build the array explicitly instead.', + )->withCodeSamples( + Documentation\CodeSample::reported(<<<'PHP' + $name, + ]; + PHP), + ); + } + public function getNodeType(): string { return Node\Expr\FuncCall::class; @@ -43,6 +77,7 @@ public function processNode( return [ Rules\RuleErrorBuilder::message('Function compact() should not be used.') ->identifier(ErrorIdentifier::noCompact()->toString()) + ->tip(Documentation\ErrorTip::for($this)) ->build(), ]; } diff --git a/tools/.phpstan/vendor/ergebnis/phpstan-rules/src/Expressions/NoErrorSuppressionRule.php b/tools/.phpstan/vendor/ergebnis/phpstan-rules/src/Expressions/NoErrorSuppressionRule.php index 3640166a2..d89468408 100644 --- a/tools/.phpstan/vendor/ergebnis/phpstan-rules/src/Expressions/NoErrorSuppressionRule.php +++ b/tools/.phpstan/vendor/ergebnis/phpstan-rules/src/Expressions/NoErrorSuppressionRule.php @@ -13,6 +13,7 @@ namespace Ergebnis\PHPStan\Rules\Expressions; +use Ergebnis\PHPStan\Rules\Documentation; use Ergebnis\PHPStan\Rules\ErrorIdentifier; use PhpParser\Node; use PHPStan\Analyser; @@ -21,8 +22,39 @@ /** * @implements Rules\Rule */ -final class NoErrorSuppressionRule implements Rules\Rule +final class NoErrorSuppressionRule implements + Documentation\HasRuleDefinition, + Rules\Rule { + public function ruleDefinition(): Documentation\RuleDefinition + { + return Documentation\RuleDefinition::create( + 'noErrorSuppression', + 'This rule reports an error when [`@`](https://www.php.net/manual/en/language.operators.errorcontrol.php) is used to suppress errors.', + 'The error control operator hides every error that the expression causes, including errors you did not expect. Check for the error condition explicitly instead.', + 'Check for the error condition explicitly instead.', + )->withCodeSamples( + Documentation\CodeSample::reported(<<<'PHP' + identifier(ErrorIdentifier::noErrorSuppression()->toString()) + ->tip(Documentation\ErrorTip::for($this)) ->build(), ]; } diff --git a/tools/.phpstan/vendor/ergebnis/phpstan-rules/src/Expressions/NoEvalRule.php b/tools/.phpstan/vendor/ergebnis/phpstan-rules/src/Expressions/NoEvalRule.php index 3cc858a09..0a12a7ebf 100644 --- a/tools/.phpstan/vendor/ergebnis/phpstan-rules/src/Expressions/NoEvalRule.php +++ b/tools/.phpstan/vendor/ergebnis/phpstan-rules/src/Expressions/NoEvalRule.php @@ -13,6 +13,7 @@ namespace Ergebnis\PHPStan\Rules\Expressions; +use Ergebnis\PHPStan\Rules\Documentation; use Ergebnis\PHPStan\Rules\ErrorIdentifier; use PhpParser\Node; use PHPStan\Analyser; @@ -21,8 +22,35 @@ /** * @implements Rules\Rule */ -final class NoEvalRule implements Rules\Rule +final class NoEvalRule implements + Documentation\HasRuleDefinition, + Rules\Rule { + public function ruleDefinition(): Documentation\RuleDefinition + { + return Documentation\RuleDefinition::create( + 'noEval', + 'This rule reports an error when the language construct [`eval()`](https://www.php.net/eval) is used.', + 'The language construct `eval()` executes a string as code, which is a security risk and cannot be analyzed statically.', + 'Write the code directly instead.', + )->withCodeSamples( + Documentation\CodeSample::reported(<<<'PHP' + identifier(ErrorIdentifier::noEval()->toString()) + ->tip(Documentation\ErrorTip::for($this)) ->build(), ]; } diff --git a/tools/.phpstan/vendor/ergebnis/phpstan-rules/src/Expressions/NoIssetRule.php b/tools/.phpstan/vendor/ergebnis/phpstan-rules/src/Expressions/NoIssetRule.php index 3b7851733..a7a875fd6 100644 --- a/tools/.phpstan/vendor/ergebnis/phpstan-rules/src/Expressions/NoIssetRule.php +++ b/tools/.phpstan/vendor/ergebnis/phpstan-rules/src/Expressions/NoIssetRule.php @@ -13,6 +13,7 @@ namespace Ergebnis\PHPStan\Rules\Expressions; +use Ergebnis\PHPStan\Rules\Documentation; use Ergebnis\PHPStan\Rules\ErrorIdentifier; use PhpParser\Node; use PHPStan\Analyser; @@ -21,8 +22,47 @@ /** * @implements Rules\Rule */ -final class NoIssetRule implements Rules\Rule +final class NoIssetRule implements + Documentation\HasRuleDefinition, + Rules\Rule { + public function ruleDefinition(): Documentation\RuleDefinition + { + return Documentation\RuleDefinition::create( + 'noIsset', + 'This rule reports an error when the language construct [`isset()`](https://www.php.net/isset) is used.', + 'The language construct `isset()` returns `false` both when a variable, array key, or property does not exist and when it holds `null`, so it hides which of the two applies. Use `array_key_exists()`, `property_exists()`, or a comparison with `null` instead.', + 'Use `array_key_exists()`, `property_exists()`, or a comparison with `null` instead.', + )->withCodeSamples( + Documentation\CodeSample::reported(<<<'PHP' + 'Jane', + ]; + + if (isset($values['name'])) { + echo $values['name']; + } + PHP), + Documentation\CodeSample::notReported(<<<'PHP' + 'Jane', + ]; + + if (\array_key_exists('name', $values)) { + echo $values['name']; + } + PHP), + ); + } + public function getNodeType(): string { return Node\Expr\Isset_::class; @@ -35,6 +75,7 @@ public function processNode( return [ Rules\RuleErrorBuilder::message('Language construct isset() should not be used.') ->identifier(ErrorIdentifier::noIsset()->toString()) + ->tip(Documentation\ErrorTip::for($this)) ->build(), ]; } diff --git a/tools/.phpstan/vendor/ergebnis/phpstan-rules/src/Files/DeclareStrictTypesRule.php b/tools/.phpstan/vendor/ergebnis/phpstan-rules/src/Files/DeclareStrictTypesRule.php index e62a85477..dc3a09a23 100644 --- a/tools/.phpstan/vendor/ergebnis/phpstan-rules/src/Files/DeclareStrictTypesRule.php +++ b/tools/.phpstan/vendor/ergebnis/phpstan-rules/src/Files/DeclareStrictTypesRule.php @@ -13,6 +13,7 @@ namespace Ergebnis\PHPStan\Rules\Files; +use Ergebnis\PHPStan\Rules\Documentation; use Ergebnis\PHPStan\Rules\ErrorIdentifier; use PhpParser\Node; use PHPStan\Analyser; @@ -22,8 +23,33 @@ /** * @implements Rules\Rule */ -final class DeclareStrictTypesRule implements Rules\Rule +final class DeclareStrictTypesRule implements + Documentation\HasRuleDefinition, + Rules\Rule { + public function ruleDefinition(): Documentation\RuleDefinition + { + return Documentation\RuleDefinition::create( + 'declareStrictTypes', + 'This rule reports an error when a non-empty file does not contain a `declare(strict_types=1)` declaration.', + 'Without a `declare(strict_types=1)` declaration, PHP coerces scalar arguments and return values to the declared types, which hides type errors.', + 'Add a `declare(strict_types=1)` declaration at the top of the file.', + )->withCodeSamples( + Documentation\CodeSample::reported(<<<'PHP' + identifier(ErrorIdentifier::declareStrictTypes()->toString()) + ->tip(Documentation\ErrorTip::for($this)) ->build(), ]; } diff --git a/tools/.phpstan/vendor/ergebnis/phpstan-rules/src/Files/NoPhpstanIgnoreRule.php b/tools/.phpstan/vendor/ergebnis/phpstan-rules/src/Files/NoPhpstanIgnoreRule.php index 28ba7e7e2..899ab3a21 100644 --- a/tools/.phpstan/vendor/ergebnis/phpstan-rules/src/Files/NoPhpstanIgnoreRule.php +++ b/tools/.phpstan/vendor/ergebnis/phpstan-rules/src/Files/NoPhpstanIgnoreRule.php @@ -13,6 +13,7 @@ namespace Ergebnis\PHPStan\Rules\Files; +use Ergebnis\PHPStan\Rules\Documentation; use Ergebnis\PHPStan\Rules\ErrorIdentifier; use PhpParser\Node; use PhpParser\NodeFinder; @@ -23,8 +24,38 @@ /** * @implements Rules\Rule */ -final class NoPhpstanIgnoreRule implements Rules\Rule +final class NoPhpstanIgnoreRule implements + Documentation\HasRuleDefinition, + Rules\Rule { + public function ruleDefinition(): Documentation\RuleDefinition + { + return Documentation\RuleDefinition::create( + 'noPhpstanIgnore', + 'This rule reports an error when a `@phpstan-ignore`, `@phpstan-ignore-line`, or `@phpstan-ignore-next-line` tag is used to [ignore errors reported by `phpstan/phpstan`](https://phpstan.org/user-guide/ignoring-errors#ignoring-in-code-using-phpdocs).', + 'An ignore tag hides an error where it occurs and tends to stay after the reason for it is gone. Fix the error, or ignore it in the configuration or the baseline, where it stays visible.', + 'Fix the error, or ignore it in the configuration or the baseline instead.', + )->withCodeSamples( + Documentation\CodeSample::reported(<<<'PHP' + identifier(ErrorIdentifier::noPhpstanIgnore()->toString()) + ->tip(Documentation\ErrorTip::for($this)) ->line($comment->getStartLine() + $index) ->nonIgnorable() ->build(); diff --git a/tools/.phpstan/vendor/ergebnis/phpstan-rules/src/Functions/NoNullableReturnTypeDeclarationRule.php b/tools/.phpstan/vendor/ergebnis/phpstan-rules/src/Functions/NoNullableReturnTypeDeclarationRule.php index 32c4f2e4d..a9feae7e5 100644 --- a/tools/.phpstan/vendor/ergebnis/phpstan-rules/src/Functions/NoNullableReturnTypeDeclarationRule.php +++ b/tools/.phpstan/vendor/ergebnis/phpstan-rules/src/Functions/NoNullableReturnTypeDeclarationRule.php @@ -14,6 +14,7 @@ namespace Ergebnis\PHPStan\Rules\Functions; use Ergebnis\PHPStan\Rules\Analyzer; +use Ergebnis\PHPStan\Rules\Documentation; use Ergebnis\PHPStan\Rules\ErrorIdentifier; use PhpParser\Node; use PHPStan\Analyser; @@ -22,7 +23,9 @@ /** * @implements Rules\Rule */ -final class NoNullableReturnTypeDeclarationRule implements Rules\Rule +final class NoNullableReturnTypeDeclarationRule implements + Documentation\HasRuleDefinition, + Rules\Rule { private Analyzer $analyzer; @@ -31,6 +34,37 @@ public function __construct(Analyzer $analyzer) $this->analyzer = $analyzer; } + public function ruleDefinition(): Documentation\RuleDefinition + { + return Documentation\RuleDefinition::create( + 'noNullableReturnTypeDeclaration', + 'This rule reports an error when a function uses a nullable return type declaration.', + 'A nullable return type forces every caller to handle `null`. Throwing an exception, returning a null object, or splitting the function in two keeps the callers simpler.', + 'Throw an exception, return a null object, or split the function in two instead.', + )->withCodeSamples( + Documentation\CodeSample::reported(<<<'PHP' + identifier(ErrorIdentifier::noNullableReturnTypeDeclaration()->toString()) + ->tip(Documentation\ErrorTip::for($this)) ->build(), ]; } diff --git a/tools/.phpstan/vendor/ergebnis/phpstan-rules/src/Functions/NoParameterPassedByReferenceRule.php b/tools/.phpstan/vendor/ergebnis/phpstan-rules/src/Functions/NoParameterPassedByReferenceRule.php index 6c9de999f..73efb9e69 100644 --- a/tools/.phpstan/vendor/ergebnis/phpstan-rules/src/Functions/NoParameterPassedByReferenceRule.php +++ b/tools/.phpstan/vendor/ergebnis/phpstan-rules/src/Functions/NoParameterPassedByReferenceRule.php @@ -13,6 +13,7 @@ namespace Ergebnis\PHPStan\Rules\Functions; +use Ergebnis\PHPStan\Rules\Documentation; use Ergebnis\PHPStan\Rules\ErrorIdentifier; use PhpParser\Node; use PHPStan\Analyser; @@ -21,8 +22,41 @@ /** * @implements Rules\Rule */ -final class NoParameterPassedByReferenceRule implements Rules\Rule +final class NoParameterPassedByReferenceRule implements + Documentation\HasRuleDefinition, + Rules\Rule { + public function ruleDefinition(): Documentation\RuleDefinition + { + return Documentation\RuleDefinition::create( + 'noParameterPassedByReference', + 'This rule reports an error when a function has a parameter that is [passed by reference](https://www.php.net/manual/en/language.references.pass.php).', + 'A parameter passed by reference lets a function change a variable of its caller as a side effect, which makes the code harder to follow. Return the new value instead.', + 'Return the new value instead.', + )->withCodeSamples( + Documentation\CodeSample::reported(<<<'PHP' + namespacedName; - return \array_map(static function (Node\Param $parameterPassedByReference) use ($functionName): Rules\RuleError { + return \array_map(function (Node\Param $parameterPassedByReference) use ($functionName): Rules\RuleError { /** @var Node\Expr\Variable $variable */ $variable = $parameterPassedByReference->var; @@ -61,6 +95,7 @@ public function processNode( return Rules\RuleErrorBuilder::message($message) ->identifier(ErrorIdentifier::noParameterPassedByReference()->toString()) + ->tip(Documentation\ErrorTip::for($this)) ->build(); }, $parametersPassedByReference); } diff --git a/tools/.phpstan/vendor/ergebnis/phpstan-rules/src/Functions/NoParameterWithNullDefaultValueRule.php b/tools/.phpstan/vendor/ergebnis/phpstan-rules/src/Functions/NoParameterWithNullDefaultValueRule.php index f22c0065d..fe0c70199 100644 --- a/tools/.phpstan/vendor/ergebnis/phpstan-rules/src/Functions/NoParameterWithNullDefaultValueRule.php +++ b/tools/.phpstan/vendor/ergebnis/phpstan-rules/src/Functions/NoParameterWithNullDefaultValueRule.php @@ -14,6 +14,7 @@ namespace Ergebnis\PHPStan\Rules\Functions; use Ergebnis\PHPStan\Rules\Analyzer; +use Ergebnis\PHPStan\Rules\Documentation; use Ergebnis\PHPStan\Rules\ErrorIdentifier; use PhpParser\Node; use PHPStan\Analyser; @@ -22,7 +23,9 @@ /** * @implements Rules\Rule */ -final class NoParameterWithNullDefaultValueRule implements Rules\Rule +final class NoParameterWithNullDefaultValueRule implements + Documentation\HasRuleDefinition, + Rules\Rule { private Analyzer $analyzer; @@ -31,6 +34,37 @@ public function __construct(Analyzer $analyzer) $this->analyzer = $analyzer; } + public function ruleDefinition(): Documentation\RuleDefinition + { + return Documentation\RuleDefinition::create( + 'noParameterWithNullDefaultValue', + 'This rule reports an error when a function has a parameter with `null` as default value.', + 'A parameter with `null` as its default value makes the argument optional and nullable at once, so the function has to handle a missing value. Separate functions or a null object make each case explicit.', + 'Use separate functions or a null object instead.', + )->withCodeSamples( + Documentation\CodeSample::reported(<<<'PHP' + namespacedName; - return \array_map(static function (Node\Param $parameterWithNullDefaultValue) use ($functionName): Rules\RuleError { + return \array_map(function (Node\Param $parameterWithNullDefaultValue) use ($functionName): Rules\RuleError { /** @var Node\Expr\Variable $variable */ $variable = $parameterWithNullDefaultValue->var; @@ -69,6 +103,7 @@ public function processNode( return Rules\RuleErrorBuilder::message($message) ->identifier(ErrorIdentifier::noParameterWithNullDefaultValue()->toString()) + ->tip(Documentation\ErrorTip::for($this)) ->build(); }, $parametersWithNullDefaultValue); } diff --git a/tools/.phpstan/vendor/ergebnis/phpstan-rules/src/Functions/NoParameterWithNullableTypeDeclarationRule.php b/tools/.phpstan/vendor/ergebnis/phpstan-rules/src/Functions/NoParameterWithNullableTypeDeclarationRule.php index 92a8ae59a..ff31e5a10 100644 --- a/tools/.phpstan/vendor/ergebnis/phpstan-rules/src/Functions/NoParameterWithNullableTypeDeclarationRule.php +++ b/tools/.phpstan/vendor/ergebnis/phpstan-rules/src/Functions/NoParameterWithNullableTypeDeclarationRule.php @@ -14,6 +14,7 @@ namespace Ergebnis\PHPStan\Rules\Functions; use Ergebnis\PHPStan\Rules\Analyzer; +use Ergebnis\PHPStan\Rules\Documentation; use Ergebnis\PHPStan\Rules\ErrorIdentifier; use PhpParser\Node; use PHPStan\Analyser; @@ -22,7 +23,9 @@ /** * @implements Rules\Rule */ -final class NoParameterWithNullableTypeDeclarationRule implements Rules\Rule +final class NoParameterWithNullableTypeDeclarationRule implements + Documentation\HasRuleDefinition, + Rules\Rule { private Analyzer $analyzer; @@ -31,6 +34,37 @@ public function __construct(Analyzer $analyzer) $this->analyzer = $analyzer; } + public function ruleDefinition(): Documentation\RuleDefinition + { + return Documentation\RuleDefinition::create( + 'noParameterWithNullableTypeDeclaration', + 'This rule reports an error when a function has a parameter with a nullable type declaration.', + 'A parameter with a nullable type declaration makes the function handle two cases: a value and `null`. Separate functions or a null object make each case explicit.', + 'Use separate functions or a null object instead.', + )->withCodeSamples( + Documentation\CodeSample::reported(<<<'PHP' + namespacedName; - return \array_map(static function (Node\Param $parameterWithNullableTypeDeclaration) use ($functionName): Rules\RuleError { + return \array_map(function (Node\Param $parameterWithNullableTypeDeclaration) use ($functionName): Rules\RuleError { /** @var Node\Expr\Variable $variable */ $variable = $parameterWithNullableTypeDeclaration->var; @@ -69,6 +103,7 @@ public function processNode( return Rules\RuleErrorBuilder::message($message) ->identifier(ErrorIdentifier::noParameterWithNullableTypeDeclaration()->toString()) + ->tip(Documentation\ErrorTip::for($this)) ->build(); }, $parametersWithNullableTypeDeclaration); } diff --git a/tools/.phpstan/vendor/ergebnis/phpstan-rules/src/Functions/NoReturnByReferenceRule.php b/tools/.phpstan/vendor/ergebnis/phpstan-rules/src/Functions/NoReturnByReferenceRule.php index 2c621e0a4..02051de7c 100644 --- a/tools/.phpstan/vendor/ergebnis/phpstan-rules/src/Functions/NoReturnByReferenceRule.php +++ b/tools/.phpstan/vendor/ergebnis/phpstan-rules/src/Functions/NoReturnByReferenceRule.php @@ -13,6 +13,7 @@ namespace Ergebnis\PHPStan\Rules\Functions; +use Ergebnis\PHPStan\Rules\Documentation; use Ergebnis\PHPStan\Rules\ErrorIdentifier; use PhpParser\Node; use PHPStan\Analyser; @@ -21,8 +22,43 @@ /** * @implements Rules\Rule */ -final class NoReturnByReferenceRule implements Rules\Rule +final class NoReturnByReferenceRule implements + Documentation\HasRuleDefinition, + Rules\Rule { + public function ruleDefinition(): Documentation\RuleDefinition + { + return Documentation\RuleDefinition::create( + 'noReturnByReference', + 'This rule reports an error when a function [returns by reference](https://www.php.net/manual/en/language.references.return.php).', + 'Returning by reference lets the caller change state that the function keeps, which makes the code harder to follow. Return a value instead.', + 'Return a value instead.', + )->withCodeSamples( + Documentation\CodeSample::reported(<<<'PHP' + identifier(ErrorIdentifier::noReturnByReference()->toString()) + ->tip(Documentation\ErrorTip::for($this)) ->build(), ]; } diff --git a/tools/.phpstan/vendor/ergebnis/phpstan-rules/src/Methods/FinalInAbstractClassRule.php b/tools/.phpstan/vendor/ergebnis/phpstan-rules/src/Methods/FinalInAbstractClassRule.php index 9c9e6fac7..d712c7faa 100644 --- a/tools/.phpstan/vendor/ergebnis/phpstan-rules/src/Methods/FinalInAbstractClassRule.php +++ b/tools/.phpstan/vendor/ergebnis/phpstan-rules/src/Methods/FinalInAbstractClassRule.php @@ -14,6 +14,7 @@ namespace Ergebnis\PHPStan\Rules\Methods; use Doctrine\ORM; +use Ergebnis\PHPStan\Rules\Documentation; use Ergebnis\PHPStan\Rules\ErrorIdentifier; use PhpParser\Node; use PHPStan\Analyser; @@ -25,20 +26,78 @@ /** * @implements Rules\Rule */ -final class FinalInAbstractClassRule implements Rules\Rule +final class FinalInAbstractClassRule implements + Documentation\HasRuleDefinition, + Rules\Rule { private const DOCTRINE_ATTRIBUTE_NAMES = [ - ORM\Mapping\Embeddable::class, ORM\Mapping\Entity::class, ]; private const DOCTRINE_ANNOTATION_NAMES = [ - '@ORM\\Mapping\\Embeddable', - '@ORM\\Embeddable', - '@Embeddable', '@ORM\\Mapping\\Entity', '@ORM\\Entity', '@Entity', ]; + private bool $ignoreDoctrineEntities; + + public function __construct(bool $ignoreDoctrineEntities) + { + $this->ignoreDoctrineEntities = $ignoreDoctrineEntities; + } + + public function ruleDefinition(): Documentation\RuleDefinition + { + return Documentation\RuleDefinition::create( + 'finalInAbstractClass', + <<<'MARKDOWN' + This rule reports an error when a concrete `public` or `protected` method in an `abstract` class is not `final`. + + πŸ’‘ By default, this rule ignores Doctrine entities. + MARKDOWN, + 'A concrete method in an `abstract` class that is not `final` can be overridden by subclasses, which can break the assumptions of the abstract class. Declare the method `final`, or `abstract` when subclasses need to provide it.', + 'Declare the method `final`, or `abstract` when subclasses need to provide it.', + Documentation\Parameter::create( + 'ignoreDoctrineEntities', + <<<'MARKDOWN' + By default, this rule ignores Doctrine entities, because Doctrine creates proxies for lazy loading by extending them. + + When you use [native lazy objects](https://github.com/doctrine/orm/pull/11853) with `doctrine/orm:^3.4.0` on PHP 8.4 or later, Doctrine no longer extends entities, and you can set the `ignoreDoctrineEntities` parameter to `false` to require concrete methods in `abstract` Doctrine entities to be `final` as well. + MARKDOWN, + false, + ), + )->withCodeSamples( + Documentation\CodeSample::reported(<<<'PHP' + getClassReflection(); - if (self::isDoctrineEntity($containingClass)) { + if ( + $this->ignoreDoctrineEntities + && self::isDoctrineEntity($containingClass) + ) { return []; } @@ -89,6 +151,7 @@ public function processNode( return [ Rules\RuleErrorBuilder::message($message) ->identifier(ErrorIdentifier::finalInAbstractClass()->toString()) + ->tip(Documentation\ErrorTip::for($this)) ->build(), ]; } diff --git a/tools/.phpstan/vendor/ergebnis/phpstan-rules/src/Methods/InvokeParentHookMethodRule.php b/tools/.phpstan/vendor/ergebnis/phpstan-rules/src/Methods/InvokeParentHookMethodRule.php index 9ac648613..40346e193 100644 --- a/tools/.phpstan/vendor/ergebnis/phpstan-rules/src/Methods/InvokeParentHookMethodRule.php +++ b/tools/.phpstan/vendor/ergebnis/phpstan-rules/src/Methods/InvokeParentHookMethodRule.php @@ -16,6 +16,7 @@ use Codeception\PHPUnit; use Codeception\Test; use Ergebnis\PHPStan\Rules\ClassName; +use Ergebnis\PHPStan\Rules\Documentation; use Ergebnis\PHPStan\Rules\ErrorIdentifier; use Ergebnis\PHPStan\Rules\HasContent; use Ergebnis\PHPStan\Rules\HookMethod; @@ -31,7 +32,9 @@ /** * @implements Rules\Rule */ -final class InvokeParentHookMethodRule implements Rules\Rule +final class InvokeParentHookMethodRule implements + Documentation\HasRuleDefinition, + Rules\Rule { private Reflection\ReflectionProvider $reflectionProvider; @@ -67,6 +70,94 @@ public function __construct( ); } + public function ruleDefinition(): Documentation\RuleDefinition + { + return Documentation\RuleDefinition::create( + 'invokeParentHookMethod', + 'This rule reports an error when a hook method that overrides a hook method in a parent class does not invoke the overridden hook method in the expected order.', + 'A hook method such as `setUp()` that overrides a hook method of a parent class needs to invoke the parent hook method in the expected order, or the parent class does not set up or tear down as intended.', + 'Move the invocation of the parent hook method to the expected position.', + Documentation\Parameter::create( + 'hookMethods', + <<<'MARKDOWN' + By default, this rule requires the following hook methods to be invoked before doing something in the overriding method: + + - [`Codeception\PHPUnit\TestCase::_setUp()`](https://github.com/Codeception/phpunit-wrapper/blob/9.0.0/src/TestCase.php#L11-L13) + - [`Codeception\PHPUnit\TestCase::_setUpBeforeClass()`](https://github.com/Codeception/phpunit-wrapper/blob/9.0.0/src/TestCase.php#L25-L27) + - [`Codeception\Test\Unit::_before()`](https://github.com/Codeception/Codeception/blob/4.2.2/src/Codeception/Test/Unit.php#L63-L65) + - [`Codeception\Test\Unit::_setUp()`](https://github.com/Codeception/Codeception/blob/4.2.2/src/Codeception/Test/Unit.php#L34-L58) + - [`PHPUnit\Framework\TestCase::assertPreConditions()`](https://github.com/sebastianbergmann/phpunit/blob/6.0.0/src/Framework/TestCase.php#L2073-L2075) + - [`PHPUnit\Framework\TestCase::setUp()`](https://github.com/sebastianbergmann/phpunit/blob/6.0.0/src/Framework/TestCase.php#L2063-L2065) + - [`PHPUnit\Framework\TestCase::setUpBeforeClass()`](https://github.com/sebastianbergmann/phpunit/blob/6.0.0/src/Framework/TestCase.php#L2055-L2057) + + By default, this rule requires the following hook methods to be invoked after doing something in the overriding method: + + - [`Codeception\PHPUnit\TestCase::_tearDown()`](https://github.com/Codeception/phpunit-wrapper/blob/9.0.0/src/TestCase.php#L18-L20) + - [`Codeception\PHPUnit\TestCase::_tearDownAfterClass()`](https://github.com/Codeception/phpunit-wrapper/blob/9.0.0/src/TestCase.php#L32-L34) + - [`Codeception\Test\Unit::_after()`](https://github.com/Codeception/Codeception/blob/4.2.2/src/Codeception/Test/Unit.php#L75-L77) + - [`Codeception\Test\Unit::_tearDown()`](https://github.com/Codeception/Codeception/blob/4.2.2/src/Codeception/Test/Unit.php#L67-L70) + - [`PHPUnit\Framework\TestCase::assertPostConditions()`](https://github.com/sebastianbergmann/phpunit/blob/6.0.0/src/Framework/TestCase.php#L2083-L2085) + - [`PHPUnit\Framework\TestCase::tearDown()`](https://github.com/sebastianbergmann/phpunit/blob/6.0.0/src/Framework/TestCase.php#L2091-L2093) + - [`PHPUnit\Framework\TestCase::tearDownAfterClass()`](https://github.com/sebastianbergmann/phpunit/blob/6.0.0/src/Framework/TestCase.php#L2098-L2100) + + You can set the `hookMethods` parameter to a list of additional hook methods, where each hook method has the following keys: + + - `className`: name of the class that declares the hook method + - `hasContent`: one of `"yes"`, `"no"` + - `invocation`: one of `"any"` (needs to be invoked), `"first"` (needs to be invoked before all other statements in the overriding hook method), `"last"` (needs to be invoked after all other statements in the overriding hook method) + - `methodName`: name of the hook method + MARKDOWN, + [ + [ + 'className' => 'Example\\Test\\Functional\\AbstractCest', + 'hasContent' => 'yes', + 'invocation' => 'first', + 'methodName' => '_before', + ], + ], + ), + )->withCodeSamples( + Documentation\CodeSample::reported(<<<'PHP' + identifier(ErrorIdentifier::invokeParentHookMethod()->toString()) + ->tip(Documentation\ErrorTip::for($this)) ->build(), ]; } @@ -146,6 +238,7 @@ public function processNode( return [ Rules\RuleErrorBuilder::message($message) ->identifier(ErrorIdentifier::invokeParentHookMethod()->toString()) + ->tip(Documentation\ErrorTip::for($this)) ->build(), ]; } @@ -161,6 +254,7 @@ public function processNode( return [ Rules\RuleErrorBuilder::message($message) ->identifier(ErrorIdentifier::invokeParentHookMethod()->toString()) + ->tip(Documentation\ErrorTip::for($this)) ->build(), ]; } diff --git a/tools/.phpstan/vendor/ergebnis/phpstan-rules/src/Methods/NoConstructorParameterWithDefaultValueRule.php b/tools/.phpstan/vendor/ergebnis/phpstan-rules/src/Methods/NoConstructorParameterWithDefaultValueRule.php index 93154748a..bf307f12e 100644 --- a/tools/.phpstan/vendor/ergebnis/phpstan-rules/src/Methods/NoConstructorParameterWithDefaultValueRule.php +++ b/tools/.phpstan/vendor/ergebnis/phpstan-rules/src/Methods/NoConstructorParameterWithDefaultValueRule.php @@ -13,6 +13,7 @@ namespace Ergebnis\PHPStan\Rules\Methods; +use Ergebnis\PHPStan\Rules\Documentation; use Ergebnis\PHPStan\Rules\ErrorIdentifier; use PhpParser\Node; use PHPStan\Analyser; @@ -22,8 +23,55 @@ /** * @implements Rules\Rule */ -final class NoConstructorParameterWithDefaultValueRule implements Rules\Rule +final class NoConstructorParameterWithDefaultValueRule implements + Documentation\HasRuleDefinition, + Rules\Rule { + public function ruleDefinition(): Documentation\RuleDefinition + { + return Documentation\RuleDefinition::create( + 'noConstructorParameterWithDefaultValue', + 'This rule reports an error when a constructor has a parameter with a default value.', + 'A constructor parameter with a default value lets callers create an object without deciding on that value. Named constructors make each way of creating the object explicit.', + 'Remove the default value and add a named constructor for each way of creating the object.', + )->withCodeSamples( + Documentation\CodeSample::reported(<<<'PHP' + salutation = $salutation; + } + } + PHP), + Documentation\CodeSample::notReported(<<<'PHP' + salutation = $salutation; + } + } + PHP), + ); + } + public function getNodeType(): string { return Node\Stmt\ClassMethod::class; @@ -53,7 +101,7 @@ public function processNode( $classReflection = $scope->getClassReflection(); if ($classReflection->isAnonymous()) { - return \array_map(static function (Node\Param $parameterWithDefaultValue): Rules\RuleError { + return \array_map(function (Node\Param $parameterWithDefaultValue): Rules\RuleError { /** @var Node\Expr\Variable $variable */ $variable = $parameterWithDefaultValue->var; @@ -67,13 +115,14 @@ public function processNode( return Rules\RuleErrorBuilder::message($message) ->identifier(ErrorIdentifier::noConstructorParameterWithDefaultValue()->toString()) + ->tip(Documentation\ErrorTip::for($this)) ->build(); }, $parametersWithDefaultValue); } $className = $classReflection->getName(); - return \array_map(static function (Node\Param $parameterWithDefaultValue) use ($className): Rules\RuleError { + return \array_map(function (Node\Param $parameterWithDefaultValue) use ($className): Rules\RuleError { /** @var Node\Expr\Variable $variable */ $variable = $parameterWithDefaultValue->var; @@ -88,6 +137,7 @@ public function processNode( return Rules\RuleErrorBuilder::message($message) ->identifier(ErrorIdentifier::noConstructorParameterWithDefaultValue()->toString()) + ->tip(Documentation\ErrorTip::for($this)) ->build(); }, $parametersWithDefaultValue); } diff --git a/tools/.phpstan/vendor/ergebnis/phpstan-rules/src/Methods/NoNullableReturnTypeDeclarationRule.php b/tools/.phpstan/vendor/ergebnis/phpstan-rules/src/Methods/NoNullableReturnTypeDeclarationRule.php index facc9fc54..3f33ef028 100644 --- a/tools/.phpstan/vendor/ergebnis/phpstan-rules/src/Methods/NoNullableReturnTypeDeclarationRule.php +++ b/tools/.phpstan/vendor/ergebnis/phpstan-rules/src/Methods/NoNullableReturnTypeDeclarationRule.php @@ -14,6 +14,7 @@ namespace Ergebnis\PHPStan\Rules\Methods; use Ergebnis\PHPStan\Rules\Analyzer; +use Ergebnis\PHPStan\Rules\Documentation; use Ergebnis\PHPStan\Rules\ErrorIdentifier; use PhpParser\Node; use PHPStan\Analyser; @@ -23,7 +24,9 @@ /** * @implements Rules\Rule */ -final class NoNullableReturnTypeDeclarationRule implements Rules\Rule +final class NoNullableReturnTypeDeclarationRule implements + Documentation\HasRuleDefinition, + Rules\Rule { private Analyzer $analyzer; @@ -32,6 +35,53 @@ public function __construct(Analyzer $analyzer) $this->analyzer = $analyzer; } + public function ruleDefinition(): Documentation\RuleDefinition + { + return Documentation\RuleDefinition::create( + 'noNullableReturnTypeDeclaration', + 'This rule reports an error when a method uses a nullable return type declaration.', + 'A nullable return type forces every caller to handle `null`. Throwing an exception, returning a null object, or splitting the method in two keeps the callers simpler.', + 'Throw an exception, return a null object, or split the method in two instead.', + )->withCodeSamples( + Documentation\CodeSample::reported(<<<'PHP' + identifier(ErrorIdentifier::noNullableReturnTypeDeclaration()->toString()) + ->tip(Documentation\ErrorTip::for($this)) ->build(), ]; } @@ -70,6 +121,7 @@ public function processNode( return [ Rules\RuleErrorBuilder::message($message) ->identifier(ErrorIdentifier::noNullableReturnTypeDeclaration()->toString()) + ->tip(Documentation\ErrorTip::for($this)) ->build(), ]; } diff --git a/tools/.phpstan/vendor/ergebnis/phpstan-rules/src/Methods/NoParameterPassedByReferenceRule.php b/tools/.phpstan/vendor/ergebnis/phpstan-rules/src/Methods/NoParameterPassedByReferenceRule.php index e50a0ef29..bbddacdb8 100644 --- a/tools/.phpstan/vendor/ergebnis/phpstan-rules/src/Methods/NoParameterPassedByReferenceRule.php +++ b/tools/.phpstan/vendor/ergebnis/phpstan-rules/src/Methods/NoParameterPassedByReferenceRule.php @@ -13,6 +13,7 @@ namespace Ergebnis\PHPStan\Rules\Methods; +use Ergebnis\PHPStan\Rules\Documentation; use Ergebnis\PHPStan\Rules\ErrorIdentifier; use PhpParser\Node; use PHPStan\Analyser; @@ -22,8 +23,51 @@ /** * @implements Rules\Rule */ -final class NoParameterPassedByReferenceRule implements Rules\Rule +final class NoParameterPassedByReferenceRule implements + Documentation\HasRuleDefinition, + Rules\Rule { + public function ruleDefinition(): Documentation\RuleDefinition + { + return Documentation\RuleDefinition::create( + 'noParameterPassedByReference', + 'This rule reports an error when a method has a parameter that is [passed by reference](https://www.php.net/manual/en/language.references.pass.php).', + 'A parameter passed by reference lets a method change a variable of its caller as a side effect, which makes the code harder to follow. Return the new value instead.', + 'Return the new value instead.', + )->withCodeSamples( + Documentation\CodeSample::reported(<<<'PHP' + getClassReflection(); if ($classReflection->isAnonymous()) { - return \array_map(static function (Node\Param $parameterExplicitlyPassedByReference) use ($methodName): Rules\RuleError { + return \array_map(function (Node\Param $parameterExplicitlyPassedByReference) use ($methodName): Rules\RuleError { /** @var Node\Expr\Variable $variable */ $variable = $parameterExplicitlyPassedByReference->var; @@ -66,13 +110,14 @@ public function processNode( return Rules\RuleErrorBuilder::message($message) ->identifier(ErrorIdentifier::noParameterPassedByReference()->toString()) + ->tip(Documentation\ErrorTip::for($this)) ->build(); }, $parametersExplicitlyPassedByReference); } $className = $classReflection->getName(); - return \array_map(static function (Node\Param $parameterExplicitlyPassedByReference) use ($className, $methodName): Rules\RuleError { + return \array_map(function (Node\Param $parameterExplicitlyPassedByReference) use ($className, $methodName): Rules\RuleError { /** @var Node\Expr\Variable $variable */ $variable = $parameterExplicitlyPassedByReference->var; @@ -88,6 +133,7 @@ public function processNode( return Rules\RuleErrorBuilder::message($message) ->identifier(ErrorIdentifier::noParameterPassedByReference()->toString()) + ->tip(Documentation\ErrorTip::for($this)) ->build(); }, $parametersExplicitlyPassedByReference); } diff --git a/tools/.phpstan/vendor/ergebnis/phpstan-rules/src/Methods/NoParameterWithContainerTypeDeclarationRule.php b/tools/.phpstan/vendor/ergebnis/phpstan-rules/src/Methods/NoParameterWithContainerTypeDeclarationRule.php index cfd88cf80..76862191b 100644 --- a/tools/.phpstan/vendor/ergebnis/phpstan-rules/src/Methods/NoParameterWithContainerTypeDeclarationRule.php +++ b/tools/.phpstan/vendor/ergebnis/phpstan-rules/src/Methods/NoParameterWithContainerTypeDeclarationRule.php @@ -13,6 +13,7 @@ namespace Ergebnis\PHPStan\Rules\Methods; +use Ergebnis\PHPStan\Rules\Documentation; use Ergebnis\PHPStan\Rules\ErrorIdentifier; use PhpParser\Node; use PHPStan\Analyser; @@ -22,7 +23,9 @@ /** * @implements Rules\Rule */ -final class NoParameterWithContainerTypeDeclarationRule implements Rules\Rule +final class NoParameterWithContainerTypeDeclarationRule implements + Documentation\HasRuleDefinition, + Rules\Rule { private Reflection\ReflectionProvider $reflectionProvider; @@ -57,6 +60,80 @@ static function (string $interfaceImplementedByContainer): bool { $this->methodsAllowedToUseContainerTypeDeclarations = $methodsAllowedToUseContainerTypeDeclarations; } + public function ruleDefinition(): Documentation\RuleDefinition + { + return Documentation\RuleDefinition::create( + 'noParameterWithContainerTypeDeclaration', + 'This rule reports an error when a method has a type declaration for a known dependency injection container or service locator.', + 'A method that receives a dependency injection container or service locator hides its actual dependencies. Inject the dependencies directly instead.', + 'Inject the dependencies directly instead.', + Documentation\Parameter::create( + 'interfacesImplementedByContainers', + <<<'MARKDOWN' + By default, this rule disallows the use of type declarations indicating an implementation of + + - [`Psr\Container\ContainerInterface`](https://github.com/php-fig/container/blob/1.0.0/src/ContainerInterface.php) + + is expected to be injected into a method. + + You can set the `interfacesImplementedByContainers` parameter to a list of interface names of additional containers and service locators. + MARKDOWN, + [ + 'Fancy\\DependencyInjection\\ContainerInterface', + 'Other\\ServiceLocatorInterface', + ], + ), + Documentation\Parameter::create( + 'methodsAllowedToUseContainerTypeDeclarations', + 'You can set the `methodsAllowedToUseContainerTypeDeclarations` parameter to a list of method names that are allowed to use parameters with container type declarations.', + [ + 'loadExtension', + ], + ), + )->withCodeSamples( + Documentation\CodeSample::reported(<<<'PHP' + get('salutation'); + } + } + PHP), + Documentation\CodeSample::notReported(<<<'PHP' + toString(); + } + } + PHP), + ); + } + public function getNodeType(): string { return Node\Stmt\ClassMethod::class; @@ -103,7 +180,7 @@ function (array $errors, Node\Param $node) use ($scope, $containingClass, $metho if ($classUsedInTypeDeclaration->isInterface()) { foreach ($this->interfacesImplementedByContainers as $interfaceImplementedByContainer) { if ($classUsedInTypeDeclaration->getName() === $interfaceImplementedByContainer) { - $errors[] = self::createError( + $errors[] = $this->createError( $containingClass, $methodName, $parameterName, @@ -114,7 +191,7 @@ function (array $errors, Node\Param $node) use ($scope, $containingClass, $metho } if ($classUsedInTypeDeclaration->getNativeReflection()->isSubclassOf($interfaceImplementedByContainer)) { - $errors[] = self::createError( + $errors[] = $this->createError( $containingClass, $methodName, $parameterName, @@ -128,7 +205,7 @@ function (array $errors, Node\Param $node) use ($scope, $containingClass, $metho foreach ($this->interfacesImplementedByContainers as $interfaceImplementedByContainer) { if ($classUsedInTypeDeclaration->getNativeReflection()->implementsInterface($interfaceImplementedByContainer)) { - $errors[] = self::createError( + $errors[] = $this->createError( $containingClass, $methodName, $parameterName, @@ -145,7 +222,7 @@ function (array $errors, Node\Param $node) use ($scope, $containingClass, $metho )); } - private static function createError( + private function createError( Reflection\ClassReflection $classReflection, string $methodName, string $parameterName, @@ -161,6 +238,7 @@ private static function createError( return Rules\RuleErrorBuilder::message($message) ->identifier(ErrorIdentifier::noParameterWithContainerTypeDeclaration()->toString()) + ->tip(Documentation\ErrorTip::for($this)) ->build(); } @@ -174,6 +252,7 @@ private static function createError( return Rules\RuleErrorBuilder::message($message) ->identifier(ErrorIdentifier::noParameterWithContainerTypeDeclaration()->toString()) + ->tip(Documentation\ErrorTip::for($this)) ->build(); } } diff --git a/tools/.phpstan/vendor/ergebnis/phpstan-rules/src/Methods/NoParameterWithNullDefaultValueRule.php b/tools/.phpstan/vendor/ergebnis/phpstan-rules/src/Methods/NoParameterWithNullDefaultValueRule.php index 5a100a1d5..fdffbf089 100644 --- a/tools/.phpstan/vendor/ergebnis/phpstan-rules/src/Methods/NoParameterWithNullDefaultValueRule.php +++ b/tools/.phpstan/vendor/ergebnis/phpstan-rules/src/Methods/NoParameterWithNullDefaultValueRule.php @@ -14,6 +14,7 @@ namespace Ergebnis\PHPStan\Rules\Methods; use Ergebnis\PHPStan\Rules\Analyzer; +use Ergebnis\PHPStan\Rules\Documentation; use Ergebnis\PHPStan\Rules\ErrorIdentifier; use PhpParser\Node; use PHPStan\Analyser; @@ -23,7 +24,9 @@ /** * @implements Rules\Rule */ -final class NoParameterWithNullDefaultValueRule implements Rules\Rule +final class NoParameterWithNullDefaultValueRule implements + Documentation\HasRuleDefinition, + Rules\Rule { private Analyzer $analyzer; @@ -32,6 +35,53 @@ public function __construct(Analyzer $analyzer) $this->analyzer = $analyzer; } + public function ruleDefinition(): Documentation\RuleDefinition + { + return Documentation\RuleDefinition::create( + 'noParameterWithNullDefaultValue', + 'This rule reports an error when a method has a parameter with `null` as default value.', + 'A parameter with `null` as its default value makes the argument optional and nullable at once, so the method has to handle a missing value. Separate methods or a null object make each case explicit.', + 'Use separate methods or a null object instead.', + )->withCodeSamples( + Documentation\CodeSample::reported(<<<'PHP' + getClassReflection(); if ($classReflection->isAnonymous()) { - return \array_map(static function (Node\Param $parameterWithNullDefaultValue) use ($methodName): Rules\RuleError { + return \array_map(function (Node\Param $parameterWithNullDefaultValue) use ($methodName): Rules\RuleError { /** @var Node\Expr\Variable $variable */ $variable = $parameterWithNullDefaultValue->var; @@ -74,13 +124,14 @@ public function processNode( return Rules\RuleErrorBuilder::message($message) ->identifier(ErrorIdentifier::noParameterWithNullDefaultValue()->toString()) + ->tip(Documentation\ErrorTip::for($this)) ->build(); }, $parametersWithNullDefaultValue); } $className = $classReflection->getName(); - return \array_map(static function (Node\Param $parameterWithNullDefaultValue) use ($className, $methodName): Rules\RuleError { + return \array_map(function (Node\Param $parameterWithNullDefaultValue) use ($className, $methodName): Rules\RuleError { /** @var Node\Expr\Variable $variable */ $variable = $parameterWithNullDefaultValue->var; @@ -96,6 +147,7 @@ public function processNode( return Rules\RuleErrorBuilder::message($message) ->identifier(ErrorIdentifier::noParameterWithNullDefaultValue()->toString()) + ->tip(Documentation\ErrorTip::for($this)) ->build(); }, $parametersWithNullDefaultValue); } diff --git a/tools/.phpstan/vendor/ergebnis/phpstan-rules/src/Methods/NoParameterWithNullableTypeDeclarationRule.php b/tools/.phpstan/vendor/ergebnis/phpstan-rules/src/Methods/NoParameterWithNullableTypeDeclarationRule.php index 73d714d7c..ef2756249 100644 --- a/tools/.phpstan/vendor/ergebnis/phpstan-rules/src/Methods/NoParameterWithNullableTypeDeclarationRule.php +++ b/tools/.phpstan/vendor/ergebnis/phpstan-rules/src/Methods/NoParameterWithNullableTypeDeclarationRule.php @@ -14,6 +14,7 @@ namespace Ergebnis\PHPStan\Rules\Methods; use Ergebnis\PHPStan\Rules\Analyzer; +use Ergebnis\PHPStan\Rules\Documentation; use Ergebnis\PHPStan\Rules\ErrorIdentifier; use PhpParser\Node; use PHPStan\Analyser; @@ -23,7 +24,9 @@ /** * @implements Rules\Rule */ -final class NoParameterWithNullableTypeDeclarationRule implements Rules\Rule +final class NoParameterWithNullableTypeDeclarationRule implements + Documentation\HasRuleDefinition, + Rules\Rule { private Analyzer $analyzer; @@ -32,6 +35,53 @@ public function __construct(Analyzer $analyzer) $this->analyzer = $analyzer; } + public function ruleDefinition(): Documentation\RuleDefinition + { + return Documentation\RuleDefinition::create( + 'noParameterWithNullableTypeDeclaration', + 'This rule reports an error when a method has a parameter with a nullable type declaration.', + 'A parameter with a nullable type declaration makes the method handle two cases: a value and `null`. Separate methods or a null object make each case explicit.', + 'Use separate methods or a null object instead.', + )->withCodeSamples( + Documentation\CodeSample::reported(<<<'PHP' + getClassReflection(); if ($classReflection->isAnonymous()) { - return \array_map(static function (Node\Param $parameterWithNullableTypeDeclaration) use ($methodName): Rules\RuleError { + return \array_map(function (Node\Param $parameterWithNullableTypeDeclaration) use ($methodName): Rules\RuleError { /** @var Node\Expr\Variable $variable */ $variable = $parameterWithNullableTypeDeclaration->var; @@ -74,13 +124,14 @@ public function processNode( return Rules\RuleErrorBuilder::message($message) ->identifier(ErrorIdentifier::noParameterWithNullableTypeDeclaration()->toString()) + ->tip(Documentation\ErrorTip::for($this)) ->build(); }, $parametersWithNullableTypeDeclaration); } $className = $classReflection->getName(); - return \array_map(static function (Node\Param $parameterWithNullableTypeDeclaration) use ($className, $methodName): Rules\RuleError { + return \array_map(function (Node\Param $parameterWithNullableTypeDeclaration) use ($className, $methodName): Rules\RuleError { /** @var Node\Expr\Variable $variable */ $variable = $parameterWithNullableTypeDeclaration->var; @@ -96,6 +147,7 @@ public function processNode( return Rules\RuleErrorBuilder::message($message) ->identifier(ErrorIdentifier::noParameterWithNullableTypeDeclaration()->toString()) + ->tip(Documentation\ErrorTip::for($this)) ->build(); }, $parametersWithNullableTypeDeclaration); } diff --git a/tools/.phpstan/vendor/ergebnis/phpstan-rules/src/Methods/NoReturnByReferenceRule.php b/tools/.phpstan/vendor/ergebnis/phpstan-rules/src/Methods/NoReturnByReferenceRule.php index 11ecbcd52..067f94871 100644 --- a/tools/.phpstan/vendor/ergebnis/phpstan-rules/src/Methods/NoReturnByReferenceRule.php +++ b/tools/.phpstan/vendor/ergebnis/phpstan-rules/src/Methods/NoReturnByReferenceRule.php @@ -13,6 +13,7 @@ namespace Ergebnis\PHPStan\Rules\Methods; +use Ergebnis\PHPStan\Rules\Documentation; use Ergebnis\PHPStan\Rules\ErrorIdentifier; use PhpParser\Node; use PHPStan\Analyser; @@ -22,8 +23,55 @@ /** * @implements Rules\Rule */ -final class NoReturnByReferenceRule implements Rules\Rule +final class NoReturnByReferenceRule implements + Documentation\HasRuleDefinition, + Rules\Rule { + public function ruleDefinition(): Documentation\RuleDefinition + { + return Documentation\RuleDefinition::create( + 'noReturnByReference', + 'This rule reports an error when a method [returns by reference](https://www.php.net/manual/en/language.references.return.php).', + 'Returning by reference lets the caller change state that the method keeps, which makes the code harder to follow. Return a value instead.', + 'Return a value instead.', + )->withCodeSamples( + Documentation\CodeSample::reported(<<<'PHP' + values; + } + } + PHP), + Documentation\CodeSample::notReported(<<<'PHP' + values; + } + } + PHP), + ); + } + public function getNodeType(): string { return Node\Stmt\ClassMethod::class; @@ -51,6 +99,7 @@ public function processNode( return [ Rules\RuleErrorBuilder::message($message) ->identifier(ErrorIdentifier::noReturnByReference()->toString()) + ->tip(Documentation\ErrorTip::for($this)) ->build(), ]; } @@ -66,6 +115,7 @@ public function processNode( return [ Rules\RuleErrorBuilder::message($message) ->identifier(ErrorIdentifier::noReturnByReference()->toString()) + ->tip(Documentation\ErrorTip::for($this)) ->build(), ]; } diff --git a/tools/.phpstan/vendor/ergebnis/phpstan-rules/src/Methods/PrivateInFinalClassRule.php b/tools/.phpstan/vendor/ergebnis/phpstan-rules/src/Methods/PrivateInFinalClassRule.php index 91fa56240..7e324443d 100644 --- a/tools/.phpstan/vendor/ergebnis/phpstan-rules/src/Methods/PrivateInFinalClassRule.php +++ b/tools/.phpstan/vendor/ergebnis/phpstan-rules/src/Methods/PrivateInFinalClassRule.php @@ -13,6 +13,7 @@ namespace Ergebnis\PHPStan\Rules\Methods; +use Ergebnis\PHPStan\Rules\Documentation; use Ergebnis\PHPStan\Rules\ErrorIdentifier; use PhpParser\Comment; use PhpParser\Node; @@ -25,7 +26,9 @@ /** * @implements Rules\Rule */ -final class PrivateInFinalClassRule implements Rules\Rule +final class PrivateInFinalClassRule implements + Documentation\HasRuleDefinition, + Rules\Rule { /** * @var list @@ -53,6 +56,47 @@ public function __construct(Type\FileTypeMapper $fileTypeMapper) $this->fileTypeMapper = $fileTypeMapper; } + public function ruleDefinition(): Documentation\RuleDefinition + { + return Documentation\RuleDefinition::create( + 'privateInFinalClass', + 'This rule reports an error when a method in a `final` class is `protected` but could be `private`.', + 'A `final` class cannot be extended, so a `protected` method in it can only be used like a `private` method. Declaring the method `private` makes that explicit.', + 'Declare the method `private` instead.', + )->withCodeSamples( + Documentation\CodeSample::reported(<<<'PHP' + identifier(ErrorIdentifier::privateInFinalClass()->toString()) + ->tip(Documentation\ErrorTip::for($this)) ->build(), ]; } @@ -120,6 +165,7 @@ public function processNode( return [ Rules\RuleErrorBuilder::message($message) ->identifier(ErrorIdentifier::privateInFinalClass()->toString()) + ->tip(Documentation\ErrorTip::for($this)) ->build(), ]; } diff --git a/tools/.phpstan/vendor/ergebnis/phpstan-rules/src/PropertyHooks/NoParameterWithNullableTypeDeclarationRule.php b/tools/.phpstan/vendor/ergebnis/phpstan-rules/src/PropertyHooks/NoParameterWithNullableTypeDeclarationRule.php new file mode 100644 index 000000000..947dac379 --- /dev/null +++ b/tools/.phpstan/vendor/ergebnis/phpstan-rules/src/PropertyHooks/NoParameterWithNullableTypeDeclarationRule.php @@ -0,0 +1,140 @@ + + */ +final class NoParameterWithNullableTypeDeclarationRule implements + Documentation\HasRuleDefinition, + Rules\Rule +{ + private Analyzer $analyzer; + + public function __construct(Analyzer $analyzer) + { + $this->analyzer = $analyzer; + } + + public function ruleDefinition(): Documentation\RuleDefinition + { + return Documentation\RuleDefinition::create( + 'noParameterWithNullableTypeDeclaration', + 'This rule reports an error when a [property hook](https://www.php.net/manual/en/language.oop5.property-hooks.php) has a parameter with a nullable type declaration.', + 'A parameter with a nullable type declaration makes the property hook handle two cases: a value and `null`. Separate properties or a null object make each case explicit.', + 'Use a separate property or a null object instead.', + )->withCodeSamples( + Documentation\CodeSample::reported(<<<'PHP' + salutation = (string) $value; + } + } + } + PHP), + Documentation\CodeSample::notReported(<<<'PHP' + salutation = $value; + } + } + } + PHP), + ); + } + + public function getNodeType(): string + { + return ClassPropertyNode::class; + } + + public function processNode( + Node $node, + Analyser\Scope $scope + ): array { + if (!$node->hasHooks()) { + return []; + } + + $propertyName = $node->getName(); + $classReflection = $node->getClassReflection(); + + $errors = []; + + foreach ($node->getHooks() as $propertyHook) { + $propertyHookName = $propertyHook->name->toString(); + + foreach ($propertyHook->params as $parameter) { + if (!$this->analyzer->isNullableTypeDeclaration($parameter->type)) { + continue; + } + + /** @var Node\Expr\Variable $variable */ + $variable = $parameter->var; + + /** @var string $parameterName */ + $parameterName = $variable->name; + + if ($classReflection->isAnonymous()) { + $message = \sprintf( + 'Property hook %s of property $%s in anonymous class has parameter $%s with a nullable type declaration.', + $propertyHookName, + $propertyName, + $parameterName, + ); + } else { + $message = \sprintf( + 'Property hook %s of property %s::$%s has parameter $%s with a nullable type declaration.', + $propertyHookName, + $classReflection->getName(), + $propertyName, + $parameterName, + ); + } + + $errors[] = Rules\RuleErrorBuilder::message($message) + ->identifier(ErrorIdentifier::noParameterWithNullableTypeDeclaration()->toString()) + ->tip(Documentation\ErrorTip::for($this)) + ->line($parameter->getStartLine()) + ->build(); + } + } + + return $errors; + } +} diff --git a/tools/.phpstan/vendor/ergebnis/phpstan-rules/src/PropertyHooks/NoReturnByReferenceRule.php b/tools/.phpstan/vendor/ergebnis/phpstan-rules/src/PropertyHooks/NoReturnByReferenceRule.php new file mode 100644 index 000000000..4b76350a4 --- /dev/null +++ b/tools/.phpstan/vendor/ergebnis/phpstan-rules/src/PropertyHooks/NoReturnByReferenceRule.php @@ -0,0 +1,130 @@ + + */ +final class NoReturnByReferenceRule implements + Documentation\HasRuleDefinition, + Rules\Rule +{ + public function ruleDefinition(): Documentation\RuleDefinition + { + return Documentation\RuleDefinition::create( + 'noReturnByReference', + 'This rule reports an error when a [property hook](https://www.php.net/manual/en/language.oop5.property-hooks.php) returns by reference.', + 'Returning by reference lets the caller change state that the property hook keeps, which makes the code harder to follow. Return a value instead.', + 'Return a value instead.', + )->withCodeSamples( + Documentation\CodeSample::reported(<<<'PHP' + $this->values; + } + } + PHP), + Documentation\CodeSample::notReported(<<<'PHP' + $this->values; + } + } + PHP), + ); + } + + public function getNodeType(): string + { + return ClassPropertyNode::class; + } + + public function processNode( + Node $node, + Analyser\Scope $scope + ): array { + if (!$node->hasHooks()) { + return []; + } + + $propertyHooksReturningByReference = \array_values(\array_filter($node->getHooks(), static function (Node\PropertyHook $propertyHook): bool { + return $propertyHook->byRef; + })); + + if (0 === \count($propertyHooksReturningByReference)) { + return []; + } + + $propertyName = $node->getName(); + $classReflection = $node->getClassReflection(); + + if ($classReflection->isAnonymous()) { + return \array_map(function (Node\PropertyHook $propertyHookReturningByReference) use ($propertyName): Rules\RuleError { + $message = \sprintf( + 'Property hook %s of property $%s in anonymous class returns by reference.', + $propertyHookReturningByReference->name->toString(), + $propertyName, + ); + + return Rules\RuleErrorBuilder::message($message) + ->identifier(ErrorIdentifier::noReturnByReference()->toString()) + ->tip(Documentation\ErrorTip::for($this)) + ->line($propertyHookReturningByReference->getStartLine()) + ->build(); + }, $propertyHooksReturningByReference); + } + + $className = $classReflection->getName(); + + return \array_map(function (Node\PropertyHook $propertyHookReturningByReference) use ($className, $propertyName): Rules\RuleError { + $message = \sprintf( + 'Property hook %s of property %s::$%s returns by reference.', + $propertyHookReturningByReference->name->toString(), + $className, + $propertyName, + ); + + return Rules\RuleErrorBuilder::message($message) + ->identifier(ErrorIdentifier::noReturnByReference()->toString()) + ->tip(Documentation\ErrorTip::for($this)) + ->line($propertyHookReturningByReference->getStartLine()) + ->build(); + }, $propertyHooksReturningByReference); + } +} diff --git a/tools/.phpstan/vendor/ergebnis/phpstan-rules/src/Statements/NoSwitchRule.php b/tools/.phpstan/vendor/ergebnis/phpstan-rules/src/Statements/NoSwitchRule.php index 38461f524..127876e73 100644 --- a/tools/.phpstan/vendor/ergebnis/phpstan-rules/src/Statements/NoSwitchRule.php +++ b/tools/.phpstan/vendor/ergebnis/phpstan-rules/src/Statements/NoSwitchRule.php @@ -13,6 +13,7 @@ namespace Ergebnis\PHPStan\Rules\Statements; +use Ergebnis\PHPStan\Rules\Documentation; use Ergebnis\PHPStan\Rules\ErrorIdentifier; use PhpParser\Node; use PHPStan\Analyser; @@ -21,8 +22,51 @@ /** * @implements Rules\Rule */ -final class NoSwitchRule implements Rules\Rule +final class NoSwitchRule implements + Documentation\HasRuleDefinition, + Rules\Rule { + public function ruleDefinition(): Documentation\RuleDefinition + { + return Documentation\RuleDefinition::create( + 'noSwitch', + 'This rule reports an error when the statement [`switch()`](https://www.php.net/manual/control-structures.switch.php) is used.', + 'A `switch` statement compares loosely and falls through to the next case without `break`, which can cause subtle bugs. Use `if` statements or `match` instead.', + 'Use `if` statements or `match` instead.', + )->withCodeSamples( + Documentation\CodeSample::reported(<<<'PHP' + identifier(ErrorIdentifier::noSwitch()->toString()) + ->tip(Documentation\ErrorTip::for($this)) ->build(), ]; } diff --git a/tools/.phpstan/vendor/phpstan/phpstan/phpstan.phar b/tools/.phpstan/vendor/phpstan/phpstan/phpstan.phar index 08390e0d1..e3e56e3bb 100755 Binary files a/tools/.phpstan/vendor/phpstan/phpstan/phpstan.phar and b/tools/.phpstan/vendor/phpstan/phpstan/phpstan.phar differ diff --git a/tools/.phpstan/vendor/phpstan/phpstan/phpstan.phar.asc b/tools/.phpstan/vendor/phpstan/phpstan/phpstan.phar.asc index 739985a7f..ddf2bb472 100644 --- a/tools/.phpstan/vendor/phpstan/phpstan/phpstan.phar.asc +++ b/tools/.phpstan/vendor/phpstan/phpstan/phpstan.phar.asc @@ -1,16 +1,16 @@ -----BEGIN PGP SIGNATURE----- -iQIzBAABCgAdFiEEynwsejDI6OEnSoR2UcZzBf/C5cAFAmrgrugACgkQUcZzBf/C -5cBGFA/+NtK12KIcaoDMNU2BDUEPxFsjuIMUtDQ8vkn4EpEGZimqMVoVd9ElmXBA -tCdKkDUSWPj/QObn1Y5a3Kb8aQex1DyCSfOykM7y9ff+OWeLpmDUYIvsQHtQSRYE -WWmyabgQRROtUe5wB/InXs2wE7HpHfXsO1rFihgXsqV76JGWqrmEhfN4vyQomjrf -IndM5MTt5fpEGNGToFLAL1cRzzlKVbKBFlJIOX1JRAeqy/ooamcGUZbrPvFSmhzf -UjnEfiiF1Ku90DV6XNr3r07upLwDepOp9UOk1c+Jv9HGVO5xeVNp1te9iTBr/nSG -LwKzL9CL0KTEBaH8lyhZAdRGMKYhMQPgsayMTibaExYinLFW+CfI1RXG3dvA6oOb -TVGx7nk4J8e1cNa0r5t15At5enY+0u0+Vvh3E677nB7h4vJa/kcjv+t2SUawjUV6 -7OvnPdhEt60+COe+z0J5biyP1Uc4892/FmCi1mvGdlajW+loRyyAX+IGCsmoubW+ -DvZtL+CA7uXEtuVUtT5hC+76Cp27v2Zag/abGip/cY2NIVslex/Gu78jRHHfyhRJ -ilwCaAEEBVD/V+Je3egxJSrBZE4AVanqhTaYDUWR6BhVYwxG5KyLJfx75C+raBb+ -ybaRD0zygP3Lu+eL1ulGS7ApcdoueUg3K1md1C6QX65wfONip8M= -=nd74 +iQIzBAABCgAdFiEEynwsejDI6OEnSoR2UcZzBf/C5cAFAmrieKAACgkQUcZzBf/C +5cATaw/+JSerEHpP/EM/wJ853EkrluaVonzIzqrqeYzqGcQP0EsNkWsTtYL+9U25 +COUWM+HBmw0NuQab5bOaQsZBXJsNcvlVD+YKnv8q3CHhySOElpzUMkaUD0oXQQha +ogTFvtN2SlvgDbWr52szAj9xxti3Xm9XvpalaFj3qlGbsWq5Js6+o8Jcu2mVgtVV +V/TF85Nw2eMQJmWqOFkXse5+GU6b8uLVZYG4RTWaXaACkf+3aZMfyd5FROMUY39Q +qTXPAYG/7cfuT8VOLyQweZmHHEBTKt2A9HJRR0OcJgiKuXxp4/1RG3pCD10TglOh +6nyHd9qL/IHztha3Oiv5nQzaL0xTa6DwLR7Wg9acVhzk3u8VkT1k508olp9+j4Td +kK1gj+aGDZo9mzXfawmzQddUc3PFZzuWtX18cb8P+Sm7/jqsgcznpTxBBwx5+MMe +pOHcSdcGE1AYTRENEF8LdUrlZuFKnQUF3gl3Tsrc2c9b5ivgZxSx5rEgalKuvOeK +WdxRhz+Jeq8RYEsI4CqsomKbvy1m/oeQEYb1zP2FhXTvGeXk77ovNeIJ45rjZIob +l8GRiIj7QoZq4eoDYrqW7y02izKxShzctmAkK3aHc4EhUULj1OEAllnAx+HV2AK7 +bmWz15TCKdtXaDgP+fRLsL1SheLIQfdHdvG5dcNe1yJ8kxj7D8E= +=uIHC -----END PGP SIGNATURE----- diff --git a/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/.version b/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/.version index 07a336989..f035ad82a 100644 --- a/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/.version +++ b/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/.version @@ -1 +1 @@ -f3d2f71 +034afd3 diff --git a/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/linux-gnu-arm64/phpstan_turbo-8.2-zts.so b/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/linux-gnu-arm64/phpstan_turbo-8.2-zts.so index e426a036a..e5318ecfc 100644 Binary files a/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/linux-gnu-arm64/phpstan_turbo-8.2-zts.so and b/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/linux-gnu-arm64/phpstan_turbo-8.2-zts.so differ diff --git a/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/linux-gnu-arm64/phpstan_turbo-8.2.so b/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/linux-gnu-arm64/phpstan_turbo-8.2.so index 77a1fb507..1754589c5 100644 Binary files a/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/linux-gnu-arm64/phpstan_turbo-8.2.so and b/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/linux-gnu-arm64/phpstan_turbo-8.2.so differ diff --git a/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/linux-gnu-arm64/phpstan_turbo-8.3-zts.so b/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/linux-gnu-arm64/phpstan_turbo-8.3-zts.so index 0c01d0561..180c66796 100644 Binary files a/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/linux-gnu-arm64/phpstan_turbo-8.3-zts.so and b/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/linux-gnu-arm64/phpstan_turbo-8.3-zts.so differ diff --git a/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/linux-gnu-arm64/phpstan_turbo-8.3.so b/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/linux-gnu-arm64/phpstan_turbo-8.3.so index 9eb547c04..bc26adc10 100644 Binary files a/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/linux-gnu-arm64/phpstan_turbo-8.3.so and b/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/linux-gnu-arm64/phpstan_turbo-8.3.so differ diff --git a/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/linux-gnu-arm64/phpstan_turbo-8.4-zts.so b/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/linux-gnu-arm64/phpstan_turbo-8.4-zts.so index f7a1e988c..18ca742c6 100644 Binary files a/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/linux-gnu-arm64/phpstan_turbo-8.4-zts.so and b/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/linux-gnu-arm64/phpstan_turbo-8.4-zts.so differ diff --git a/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/linux-gnu-arm64/phpstan_turbo-8.4.so b/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/linux-gnu-arm64/phpstan_turbo-8.4.so index beb12d6b8..2579e7476 100644 Binary files a/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/linux-gnu-arm64/phpstan_turbo-8.4.so and b/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/linux-gnu-arm64/phpstan_turbo-8.4.so differ diff --git a/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/linux-gnu-arm64/phpstan_turbo-8.5-zts.so b/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/linux-gnu-arm64/phpstan_turbo-8.5-zts.so index c1262dd19..68fa1332f 100644 Binary files a/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/linux-gnu-arm64/phpstan_turbo-8.5-zts.so and b/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/linux-gnu-arm64/phpstan_turbo-8.5-zts.so differ diff --git a/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/linux-gnu-arm64/phpstan_turbo-8.5.so b/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/linux-gnu-arm64/phpstan_turbo-8.5.so index 638acffe6..7bccdfe68 100644 Binary files a/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/linux-gnu-arm64/phpstan_turbo-8.5.so and b/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/linux-gnu-arm64/phpstan_turbo-8.5.so differ diff --git a/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/linux-gnu-arm64/phpstan_turbo-8.6-zts.so b/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/linux-gnu-arm64/phpstan_turbo-8.6-zts.so index ac75967db..bd4c8b9e9 100644 Binary files a/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/linux-gnu-arm64/phpstan_turbo-8.6-zts.so and b/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/linux-gnu-arm64/phpstan_turbo-8.6-zts.so differ diff --git a/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/linux-gnu-arm64/phpstan_turbo-8.6.so b/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/linux-gnu-arm64/phpstan_turbo-8.6.so index 6143fe6be..e6823cfb5 100644 Binary files a/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/linux-gnu-arm64/phpstan_turbo-8.6.so and b/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/linux-gnu-arm64/phpstan_turbo-8.6.so differ diff --git a/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/linux-gnu-arm64/phpstan_turbo_core.so b/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/linux-gnu-arm64/phpstan_turbo_core.so index 3c7fd2dca..afdabafd1 100644 Binary files a/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/linux-gnu-arm64/phpstan_turbo_core.so and b/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/linux-gnu-arm64/phpstan_turbo_core.so differ diff --git a/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/linux-gnu-x86_64/phpstan_turbo-8.2-zts.so b/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/linux-gnu-x86_64/phpstan_turbo-8.2-zts.so index 8bdcbd173..918052f7d 100644 Binary files a/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/linux-gnu-x86_64/phpstan_turbo-8.2-zts.so and b/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/linux-gnu-x86_64/phpstan_turbo-8.2-zts.so differ diff --git a/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/linux-gnu-x86_64/phpstan_turbo-8.2.so b/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/linux-gnu-x86_64/phpstan_turbo-8.2.so index c78e5bb32..843d4c6f9 100644 Binary files a/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/linux-gnu-x86_64/phpstan_turbo-8.2.so and b/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/linux-gnu-x86_64/phpstan_turbo-8.2.so differ diff --git a/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/linux-gnu-x86_64/phpstan_turbo-8.3-zts.so b/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/linux-gnu-x86_64/phpstan_turbo-8.3-zts.so index af4f8e7a5..663344a7f 100644 Binary files a/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/linux-gnu-x86_64/phpstan_turbo-8.3-zts.so and b/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/linux-gnu-x86_64/phpstan_turbo-8.3-zts.so differ diff --git a/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/linux-gnu-x86_64/phpstan_turbo-8.3.so b/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/linux-gnu-x86_64/phpstan_turbo-8.3.so index 1feb1a3a0..00197d191 100644 Binary files a/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/linux-gnu-x86_64/phpstan_turbo-8.3.so and b/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/linux-gnu-x86_64/phpstan_turbo-8.3.so differ diff --git a/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/linux-gnu-x86_64/phpstan_turbo-8.4-zts.so b/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/linux-gnu-x86_64/phpstan_turbo-8.4-zts.so index 3fd1a65ef..4d9649bbe 100644 Binary files a/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/linux-gnu-x86_64/phpstan_turbo-8.4-zts.so and b/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/linux-gnu-x86_64/phpstan_turbo-8.4-zts.so differ diff --git a/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/linux-gnu-x86_64/phpstan_turbo-8.4.so b/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/linux-gnu-x86_64/phpstan_turbo-8.4.so index 35292dc4d..8b988a5ba 100644 Binary files a/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/linux-gnu-x86_64/phpstan_turbo-8.4.so and b/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/linux-gnu-x86_64/phpstan_turbo-8.4.so differ diff --git a/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/linux-gnu-x86_64/phpstan_turbo-8.5-zts.so b/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/linux-gnu-x86_64/phpstan_turbo-8.5-zts.so index 4f07c5ce7..1b9d57deb 100644 Binary files a/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/linux-gnu-x86_64/phpstan_turbo-8.5-zts.so and b/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/linux-gnu-x86_64/phpstan_turbo-8.5-zts.so differ diff --git a/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/linux-gnu-x86_64/phpstan_turbo-8.5.so b/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/linux-gnu-x86_64/phpstan_turbo-8.5.so index 018cb4674..e24a63152 100644 Binary files a/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/linux-gnu-x86_64/phpstan_turbo-8.5.so and b/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/linux-gnu-x86_64/phpstan_turbo-8.5.so differ diff --git a/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/linux-gnu-x86_64/phpstan_turbo-8.6-zts.so b/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/linux-gnu-x86_64/phpstan_turbo-8.6-zts.so index 2b49089df..bd3ec84ac 100644 Binary files a/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/linux-gnu-x86_64/phpstan_turbo-8.6-zts.so and b/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/linux-gnu-x86_64/phpstan_turbo-8.6-zts.so differ diff --git a/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/linux-gnu-x86_64/phpstan_turbo-8.6.so b/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/linux-gnu-x86_64/phpstan_turbo-8.6.so index e46ce9615..245d28564 100644 Binary files a/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/linux-gnu-x86_64/phpstan_turbo-8.6.so and b/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/linux-gnu-x86_64/phpstan_turbo-8.6.so differ diff --git a/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/linux-gnu-x86_64/phpstan_turbo_core.so b/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/linux-gnu-x86_64/phpstan_turbo_core.so index d8652c466..538a40b2d 100644 Binary files a/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/linux-gnu-x86_64/phpstan_turbo_core.so and b/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/linux-gnu-x86_64/phpstan_turbo_core.so differ diff --git a/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/linux-musl-arm64/phpstan_turbo-8.2-zts.so b/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/linux-musl-arm64/phpstan_turbo-8.2-zts.so index b78ec3b5d..2c63cad63 100644 Binary files a/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/linux-musl-arm64/phpstan_turbo-8.2-zts.so and b/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/linux-musl-arm64/phpstan_turbo-8.2-zts.so differ diff --git a/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/linux-musl-arm64/phpstan_turbo-8.2.so b/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/linux-musl-arm64/phpstan_turbo-8.2.so index 46c78c5d6..45fd2f107 100644 Binary files a/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/linux-musl-arm64/phpstan_turbo-8.2.so and b/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/linux-musl-arm64/phpstan_turbo-8.2.so differ diff --git a/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/linux-musl-arm64/phpstan_turbo-8.3-zts.so b/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/linux-musl-arm64/phpstan_turbo-8.3-zts.so index e7efca8c4..cb5c0d236 100644 Binary files a/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/linux-musl-arm64/phpstan_turbo-8.3-zts.so and b/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/linux-musl-arm64/phpstan_turbo-8.3-zts.so differ diff --git a/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/linux-musl-arm64/phpstan_turbo-8.3.so b/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/linux-musl-arm64/phpstan_turbo-8.3.so index 2e6d732ca..f0d64bd73 100644 Binary files a/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/linux-musl-arm64/phpstan_turbo-8.3.so and b/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/linux-musl-arm64/phpstan_turbo-8.3.so differ diff --git a/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/linux-musl-arm64/phpstan_turbo-8.4-zts.so b/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/linux-musl-arm64/phpstan_turbo-8.4-zts.so index bb9cb3167..2d28bbc7e 100644 Binary files a/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/linux-musl-arm64/phpstan_turbo-8.4-zts.so and b/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/linux-musl-arm64/phpstan_turbo-8.4-zts.so differ diff --git a/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/linux-musl-arm64/phpstan_turbo-8.4.so b/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/linux-musl-arm64/phpstan_turbo-8.4.so index 4a4de722f..899e2b132 100644 Binary files a/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/linux-musl-arm64/phpstan_turbo-8.4.so and b/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/linux-musl-arm64/phpstan_turbo-8.4.so differ diff --git a/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/linux-musl-arm64/phpstan_turbo-8.5-zts.so b/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/linux-musl-arm64/phpstan_turbo-8.5-zts.so index 8bd620379..fdb6eeb6b 100644 Binary files a/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/linux-musl-arm64/phpstan_turbo-8.5-zts.so and b/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/linux-musl-arm64/phpstan_turbo-8.5-zts.so differ diff --git a/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/linux-musl-arm64/phpstan_turbo-8.5.so b/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/linux-musl-arm64/phpstan_turbo-8.5.so index 0f0765ccb..9c0fbdc65 100644 Binary files a/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/linux-musl-arm64/phpstan_turbo-8.5.so and b/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/linux-musl-arm64/phpstan_turbo-8.5.so differ diff --git a/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/linux-musl-arm64/phpstan_turbo-8.6-zts.so b/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/linux-musl-arm64/phpstan_turbo-8.6-zts.so index b1f37c47d..a77b751ea 100644 Binary files a/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/linux-musl-arm64/phpstan_turbo-8.6-zts.so and b/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/linux-musl-arm64/phpstan_turbo-8.6-zts.so differ diff --git a/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/linux-musl-arm64/phpstan_turbo-8.6.so b/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/linux-musl-arm64/phpstan_turbo-8.6.so index e08d8a574..e1ce23960 100644 Binary files a/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/linux-musl-arm64/phpstan_turbo-8.6.so and b/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/linux-musl-arm64/phpstan_turbo-8.6.so differ diff --git a/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/linux-musl-arm64/phpstan_turbo_core.so b/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/linux-musl-arm64/phpstan_turbo_core.so index 3882edeb8..18ed96776 100644 Binary files a/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/linux-musl-arm64/phpstan_turbo_core.so and b/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/linux-musl-arm64/phpstan_turbo_core.so differ diff --git a/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/linux-musl-x86_64/phpstan_turbo-8.2-zts.so b/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/linux-musl-x86_64/phpstan_turbo-8.2-zts.so index c59bb5cf8..9e0c74340 100644 Binary files a/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/linux-musl-x86_64/phpstan_turbo-8.2-zts.so and b/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/linux-musl-x86_64/phpstan_turbo-8.2-zts.so differ diff --git a/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/linux-musl-x86_64/phpstan_turbo-8.2.so b/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/linux-musl-x86_64/phpstan_turbo-8.2.so index 99d155d02..a6ffa352d 100644 Binary files a/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/linux-musl-x86_64/phpstan_turbo-8.2.so and b/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/linux-musl-x86_64/phpstan_turbo-8.2.so differ diff --git a/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/linux-musl-x86_64/phpstan_turbo-8.3-zts.so b/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/linux-musl-x86_64/phpstan_turbo-8.3-zts.so index 499061601..4ddc5fe55 100644 Binary files a/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/linux-musl-x86_64/phpstan_turbo-8.3-zts.so and b/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/linux-musl-x86_64/phpstan_turbo-8.3-zts.so differ diff --git a/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/linux-musl-x86_64/phpstan_turbo-8.3.so b/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/linux-musl-x86_64/phpstan_turbo-8.3.so index 9b4eebbd2..1a14c96fe 100644 Binary files a/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/linux-musl-x86_64/phpstan_turbo-8.3.so and b/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/linux-musl-x86_64/phpstan_turbo-8.3.so differ diff --git a/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/linux-musl-x86_64/phpstan_turbo-8.4-zts.so b/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/linux-musl-x86_64/phpstan_turbo-8.4-zts.so index c0db1085c..9d2a6a4cb 100644 Binary files a/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/linux-musl-x86_64/phpstan_turbo-8.4-zts.so and b/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/linux-musl-x86_64/phpstan_turbo-8.4-zts.so differ diff --git a/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/linux-musl-x86_64/phpstan_turbo-8.4.so b/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/linux-musl-x86_64/phpstan_turbo-8.4.so index 634c53128..03cb8f5a7 100644 Binary files a/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/linux-musl-x86_64/phpstan_turbo-8.4.so and b/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/linux-musl-x86_64/phpstan_turbo-8.4.so differ diff --git a/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/linux-musl-x86_64/phpstan_turbo-8.5-zts.so b/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/linux-musl-x86_64/phpstan_turbo-8.5-zts.so index 8d8c35721..5ed057c43 100644 Binary files a/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/linux-musl-x86_64/phpstan_turbo-8.5-zts.so and b/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/linux-musl-x86_64/phpstan_turbo-8.5-zts.so differ diff --git a/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/linux-musl-x86_64/phpstan_turbo-8.5.so b/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/linux-musl-x86_64/phpstan_turbo-8.5.so index 32a093264..9509cf4ff 100644 Binary files a/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/linux-musl-x86_64/phpstan_turbo-8.5.so and b/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/linux-musl-x86_64/phpstan_turbo-8.5.so differ diff --git a/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/linux-musl-x86_64/phpstan_turbo-8.6-zts.so b/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/linux-musl-x86_64/phpstan_turbo-8.6-zts.so index aa9328ed3..5b2a52767 100644 Binary files a/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/linux-musl-x86_64/phpstan_turbo-8.6-zts.so and b/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/linux-musl-x86_64/phpstan_turbo-8.6-zts.so differ diff --git a/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/linux-musl-x86_64/phpstan_turbo-8.6.so b/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/linux-musl-x86_64/phpstan_turbo-8.6.so index d1e811dc3..33bce42d4 100644 Binary files a/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/linux-musl-x86_64/phpstan_turbo-8.6.so and b/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/linux-musl-x86_64/phpstan_turbo-8.6.so differ diff --git a/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/linux-musl-x86_64/phpstan_turbo_core.so b/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/linux-musl-x86_64/phpstan_turbo_core.so index 2d7f6eae1..45bdf413e 100644 Binary files a/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/linux-musl-x86_64/phpstan_turbo_core.so and b/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/linux-musl-x86_64/phpstan_turbo_core.so differ diff --git a/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/macos-arm64/phpstan_turbo-8.2.so b/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/macos-arm64/phpstan_turbo-8.2.so index 50d50bfcc..3f8bef300 100644 Binary files a/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/macos-arm64/phpstan_turbo-8.2.so and b/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/macos-arm64/phpstan_turbo-8.2.so differ diff --git a/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/macos-arm64/phpstan_turbo-8.3.so b/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/macos-arm64/phpstan_turbo-8.3.so index 7fd7eb52f..395519744 100644 Binary files a/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/macos-arm64/phpstan_turbo-8.3.so and b/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/macos-arm64/phpstan_turbo-8.3.so differ diff --git a/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/macos-arm64/phpstan_turbo-8.4.so b/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/macos-arm64/phpstan_turbo-8.4.so index ca35b7f91..342c87cc5 100644 Binary files a/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/macos-arm64/phpstan_turbo-8.4.so and b/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/macos-arm64/phpstan_turbo-8.4.so differ diff --git a/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/macos-arm64/phpstan_turbo-8.5.so b/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/macos-arm64/phpstan_turbo-8.5.so index 0e6662d4d..e4c8a9584 100644 Binary files a/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/macos-arm64/phpstan_turbo-8.5.so and b/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/macos-arm64/phpstan_turbo-8.5.so differ diff --git a/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/macos-arm64/phpstan_turbo-8.6.so b/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/macos-arm64/phpstan_turbo-8.6.so index ab2639d6b..610aff0a0 100644 Binary files a/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/macos-arm64/phpstan_turbo-8.6.so and b/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/macos-arm64/phpstan_turbo-8.6.so differ diff --git a/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/macos-arm64/phpstan_turbo_core.so b/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/macos-arm64/phpstan_turbo_core.so index 690c5afb7..edce78ef4 100644 Binary files a/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/macos-arm64/phpstan_turbo_core.so and b/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/macos-arm64/phpstan_turbo_core.so differ diff --git a/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/windows-x86_64/phpstan_turbo-8.2-zts.dll b/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/windows-x86_64/phpstan_turbo-8.2-zts.dll index 129433ec9..ea3357226 100644 Binary files a/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/windows-x86_64/phpstan_turbo-8.2-zts.dll and b/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/windows-x86_64/phpstan_turbo-8.2-zts.dll differ diff --git a/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/windows-x86_64/phpstan_turbo-8.2.dll b/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/windows-x86_64/phpstan_turbo-8.2.dll index e414519dc..6c959744c 100644 Binary files a/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/windows-x86_64/phpstan_turbo-8.2.dll and b/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/windows-x86_64/phpstan_turbo-8.2.dll differ diff --git a/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/windows-x86_64/phpstan_turbo-8.3-zts.dll b/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/windows-x86_64/phpstan_turbo-8.3-zts.dll index df91bf296..7ea34621f 100644 Binary files a/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/windows-x86_64/phpstan_turbo-8.3-zts.dll and b/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/windows-x86_64/phpstan_turbo-8.3-zts.dll differ diff --git a/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/windows-x86_64/phpstan_turbo-8.3.dll b/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/windows-x86_64/phpstan_turbo-8.3.dll index e8e62ab2a..1aa2dd0f6 100644 Binary files a/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/windows-x86_64/phpstan_turbo-8.3.dll and b/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/windows-x86_64/phpstan_turbo-8.3.dll differ diff --git a/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/windows-x86_64/phpstan_turbo-8.4-zts.dll b/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/windows-x86_64/phpstan_turbo-8.4-zts.dll index 41ead4f98..26a70f98b 100644 Binary files a/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/windows-x86_64/phpstan_turbo-8.4-zts.dll and b/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/windows-x86_64/phpstan_turbo-8.4-zts.dll differ diff --git a/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/windows-x86_64/phpstan_turbo-8.4.dll b/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/windows-x86_64/phpstan_turbo-8.4.dll index 3a9653b32..599e6734c 100644 Binary files a/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/windows-x86_64/phpstan_turbo-8.4.dll and b/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/windows-x86_64/phpstan_turbo-8.4.dll differ diff --git a/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/windows-x86_64/phpstan_turbo-8.5-zts.dll b/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/windows-x86_64/phpstan_turbo-8.5-zts.dll index 1cda2f516..a1ee5218a 100644 Binary files a/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/windows-x86_64/phpstan_turbo-8.5-zts.dll and b/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/windows-x86_64/phpstan_turbo-8.5-zts.dll differ diff --git a/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/windows-x86_64/phpstan_turbo-8.5.dll b/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/windows-x86_64/phpstan_turbo-8.5.dll index 9c8c1eb4c..15e6e17c0 100644 Binary files a/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/windows-x86_64/phpstan_turbo-8.5.dll and b/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/windows-x86_64/phpstan_turbo-8.5.dll differ diff --git a/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/windows-x86_64/phpstan_turbo-8.6-zts.dll b/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/windows-x86_64/phpstan_turbo-8.6-zts.dll index 8d5aeaa33..e47fee133 100644 Binary files a/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/windows-x86_64/phpstan_turbo-8.6-zts.dll and b/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/windows-x86_64/phpstan_turbo-8.6-zts.dll differ diff --git a/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/windows-x86_64/phpstan_turbo-8.6.dll b/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/windows-x86_64/phpstan_turbo-8.6.dll index f8d77014b..f64c88820 100644 Binary files a/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/windows-x86_64/phpstan_turbo-8.6.dll and b/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/windows-x86_64/phpstan_turbo-8.6.dll differ diff --git a/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/windows-x86_64/phpstan_turbo_core-zts.dll b/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/windows-x86_64/phpstan_turbo_core-zts.dll index 70a6d23b1..ed257ae64 100644 Binary files a/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/windows-x86_64/phpstan_turbo_core-zts.dll and b/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/windows-x86_64/phpstan_turbo_core-zts.dll differ diff --git a/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/windows-x86_64/phpstan_turbo_core.dll b/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/windows-x86_64/phpstan_turbo_core.dll index 0a66e4d11..0048d9582 100644 Binary files a/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/windows-x86_64/phpstan_turbo_core.dll and b/tools/.phpstan/vendor/phpstan/phpstan/turbo-ext/windows-x86_64/phpstan_turbo_core.dll differ