Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,16 @@ parameters:
naming: false
```

The `code-complexity-rules.neon`, `configurable-rules.neon` and `static-rules.neon` sets are **enabled by default** once included, and can be toggled the same way:

```yaml
parameters:
symplify:
complexity: false
configurable: false
static: false
```

<br>

### Symfony/Laravel container `->get()`/`->make()` return type extensions
Expand Down
18 changes: 17 additions & 1 deletion config/code-complexity-rules.neon
Original file line number Diff line number Diff line change
@@ -1,4 +1,20 @@
rules:
conditionalTags:
Symplify\PHPStanRules\Rules\NoDynamicNameRule:
phpstan.rules.rule: %symplify.complexity%
Symplify\PHPStanRules\Rules\Complexity\NoJustPropertyAssignRule:
phpstan.rules.rule: %symplify.complexity%
Symplify\PHPStanRules\Rules\Complexity\NoPropertyToPropertyAssignRule:
phpstan.rules.rule: %symplify.complexity%
Symplify\PHPStanRules\Rules\Complexity\NoArrayMapWithArrayCallableRule:
phpstan.rules.rule: %symplify.complexity%
Symplify\PHPStanRules\Rules\Complexity\NoConstructorOverrideRule:
phpstan.rules.rule: %symplify.complexity%
Symplify\PHPStanRules\Rules\Complexity\ForeachCeptionRule:
phpstan.rules.rule: %symplify.complexity%
Symplify\PHPStanRules\Rules\Explicit\NoMissingVariableDimFetchRule:
phpstan.rules.rule: %symplify.complexity%

services:
- Symplify\PHPStanRules\Rules\NoDynamicNameRule
- Symplify\PHPStanRules\Rules\Complexity\NoJustPropertyAssignRule
- Symplify\PHPStanRules\Rules\Complexity\NoPropertyToPropertyAssignRule
Expand Down
14 changes: 10 additions & 4 deletions config/configurable-rules.neon
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
conditionalTags:
Symplify\PHPStanRules\Rules\ForbiddenNodeRule:
phpstan.rules.rule: %symplify.configurable%
Symplify\PHPStanRules\Rules\PreferredClassRule:
phpstan.rules.rule: %symplify.configurable%
Symplify\PHPStanRules\Rules\ForbiddenFuncCallRule:
phpstan.rules.rule: %symplify.configurable%
Symplify\PHPStanRules\Rules\SeeAnnotationToTestRule:
phpstan.rules.rule: %symplify.configurable%

services:
-
class: Symplify\PHPStanRules\Rules\ForbiddenNodeRule
tags: [phpstan.rules.rule]
arguments:
forbiddenNodes:
- PhpParser\Node\Stmt\Trait_
Expand All @@ -16,7 +25,6 @@ services:

-
class: Symplify\PHPStanRules\Rules\PreferredClassRule
tags: [phpstan.rules.rule]
arguments:
oldToPreferredClasses:
# prevents typos
Expand All @@ -25,7 +33,6 @@ services:

-
class: Symplify\PHPStanRules\Rules\ForbiddenFuncCallRule
tags: [phpstan.rules.rule]
arguments:
forbiddenFunctions:
- 'd'
Expand All @@ -43,7 +50,6 @@ services:

-
class: Symplify\PHPStanRules\Rules\SeeAnnotationToTestRule
tags: [phpstan.rules.rule]
arguments:
requiredSeeTypes:
- PHPStan\Rules\Rule
Expand Down
6 changes: 6 additions & 0 deletions config/phpstan-extensions.neon
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
parameters:
symplify:
naming: true
complexity: true
configurable: true
static: true
mocks: false
ctor: false
symfonyReturnType: false
Expand All @@ -15,6 +18,9 @@ parameters:
parametersSchema:
symplify: structure([
naming: bool()
complexity: bool()
configurable: bool()
static: bool()
mocks: bool()
ctor: bool()
symfonyReturnType: bool()
Expand Down
36 changes: 35 additions & 1 deletion config/static-rules.neon
Original file line number Diff line number Diff line change
@@ -1,4 +1,38 @@
rules:
conditionalTags:
Symplify\PHPStanRules\Rules\ForbiddenExtendOfNonAbstractClassRule:
phpstan.rules.rule: %symplify.static%
Symplify\PHPStanRules\Rules\NoGlobalConstRule:
phpstan.rules.rule: %symplify.static%

# domain
Symplify\PHPStanRules\Rules\RequireAttributeNameRule:
phpstan.rules.rule: %symplify.static%

Symplify\PHPStanRules\Rules\Enum\RequireUniqueEnumConstantRule:
phpstan.rules.rule: %symplify.static%
Symplify\PHPStanRules\Rules\PreventParentMethodVisibilityOverrideRule:
phpstan.rules.rule: %symplify.static%

Symplify\PHPStanRules\Rules\ForbiddenMultipleClassLikeInOneFileRule:
phpstan.rules.rule: %symplify.static%
Symplify\PHPStanRules\Rules\NoReferenceRule:
phpstan.rules.rule: %symplify.static%
Symplify\PHPStanRules\Rules\ForbiddenStaticClassConstFetchRule:
phpstan.rules.rule: %symplify.static%
Symplify\PHPStanRules\Rules\Complexity\ForbiddenArrayMethodCallRule:
phpstan.rules.rule: %symplify.static%

# docblock
Symplify\PHPStanRules\Rules\NoMissnamedDocTagRule:
phpstan.rules.rule: %symplify.static%
Symplify\PHPStanRules\Rules\RequireArrayShapeReturnRule:
phpstan.rules.rule: %symplify.static%

# attributes
Symplify\PHPStanRules\Rules\NoDuplicateNonRepeatableAttributeRule:
phpstan.rules.rule: %symplify.static%

services:
- Symplify\PHPStanRules\Rules\ForbiddenExtendOfNonAbstractClassRule
- Symplify\PHPStanRules\Rules\NoGlobalConstRule

Expand Down
1 change: 0 additions & 1 deletion config/symplify-rules.neon
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
includes:
- code-complexity-rules.neon
- configurable-rules.neon
- naming-rules.neon
- static-rules.neon
Loading