From a29d76d87dfbbb8fe227fa07033a07b788f68e70 Mon Sep 17 00:00:00 2001 From: Tomas Votruba Date: Tue, 22 Sep 2026 12:11:33 +0200 Subject: [PATCH 1/3] group naming rules under 'naming' parameter, on by default --- README.md | 43 +++++++++------------------------- composer.json | 1 + config/naming-rules.neon | 23 +++++++++++++++++- config/phpstan-extensions.neon | 2 ++ config/static-rules.neon | 3 --- 5 files changed, 36 insertions(+), 36 deletions(-) diff --git a/README.md b/README.md index 9049aa9a7..02fc1ebd8 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,6 @@ Once you have most rules applied, it's best practice to include whole sets: includes: - vendor/symplify/phpstan-rules/config/code-complexity-rules.neon - vendor/symplify/phpstan-rules/config/configurable-rules.neon - - vendor/symplify/phpstan-rules/config/naming-rules.neon - vendor/symplify/phpstan-rules/config/static-rules.neon # project specific @@ -49,6 +48,16 @@ includes:
+The naming rules (class/constant naming and namespace rules, e.g. interface must live in a "Contract" namespace) load automatically and are **enabled by default**. Turn them off with the `naming` parameter: + +```yaml +parameters: + symplify: + naming: false +``` + +
+ ### Symfony/Laravel container `->get()`/`->make()` return type extensions Want sharper type inference? The return type extensions are **disabled by default** — enable the ones that fit your stack: @@ -155,11 +164,6 @@ function run(int $userId) Interface must be located in "Contract" or "Contracts" namespace -```yaml -rules: - - Symplify\PHPStanRules\Rules\CheckRequiredInterfaceInContractNamespaceRule -``` - ```php namespace App\Repository; @@ -188,7 +192,7 @@ interface ProductRepositoryInterface Class should have suffix "%s" to respect parent type -:wrench: **configure it!** +On by default via the `naming` parameter with a built-in parent list. To extend it with your own parents, set `naming: false` and register the rule yourself: ```yaml services: @@ -327,11 +331,6 @@ final class SomeClass extends ParentClass Interface have suffix of "Interface", trait have "Trait" suffix exclusively -```yaml -rules: - - Symplify\PHPStanRules\Rules\Explicit\ExplicitClassPrefixSuffixRule -``` - ```php Date: Tue, 22 Sep 2026 12:34:51 +0200 Subject: [PATCH 2/3] keep per-rule registration snippets in README --- README.md | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 02fc1ebd8..cb2a1cb22 100644 --- a/README.md +++ b/README.md @@ -164,6 +164,11 @@ function run(int $userId) Interface must be located in "Contract" or "Contracts" namespace +```yaml +rules: + - Symplify\PHPStanRules\Rules\CheckRequiredInterfaceInContractNamespaceRule +``` + ```php namespace App\Repository; @@ -192,7 +197,7 @@ interface ProductRepositoryInterface Class should have suffix "%s" to respect parent type -On by default via the `naming` parameter with a built-in parent list. To extend it with your own parents, set `naming: false` and register the rule yourself: +:wrench: **configure it!** ```yaml services: @@ -331,6 +336,11 @@ final class SomeClass extends ParentClass Interface have suffix of "Interface", trait have "Trait" suffix exclusively +```yaml +rules: + - Symplify\PHPStanRules\Rules\Explicit\ExplicitClassPrefixSuffixRule +``` + ```php Date: Tue, 22 Sep 2026 12:35:57 +0200 Subject: [PATCH 3/3] list ExplicitClassPrefixSuffixRule identifiers in README --- README.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/README.md b/README.md index cb2a1cb22..512cb83dc 100644 --- a/README.md +++ b/README.md @@ -341,6 +341,14 @@ rules: - Symplify\PHPStanRules\Rules\Explicit\ExplicitClassPrefixSuffixRule ``` +Reported under these identifiers: + +```yaml +- identifier: symplify.explicitAbstractPrefixName +- identifier: symplify.explicitInterfaceSuffixName +- identifier: symplify.explicitTraitSuffixName +``` + ```php