Skip to content

Commit 0c646b8

Browse files
authored
Seperate symfony rules into config/symfony-rules.neon (#25)
1 parent c854acc commit 0c646b8

File tree

4 files changed

+26
-12
lines changed

4 files changed

+26
-12
lines changed

README.md

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,6 @@ includes:
2929
3030
## Rules
3131
32-
1. `SlamPhpStan\SymfonyFilesystemRule`: forbid calls to raw filesystem functions well wrapped by
33-
[`symfony/filesystem`](https://github.com/symfony/filesystem) component
34-
1. `SlamPhpStan\SymfonyProcessRule`: forbid calls to raw system functions well wrapped by
35-
[`symfony/process`](https://github.com/symfony/process) component
3632
1. `SlamPhpStan\UnusedVariableRule`: check for variable inside functions never used after initial assignment
3733
1. `SlamPhpStan\MissingClosureParameterTypehintRule`: requires parameter typehints for closures; WARNING: no PhpDoc
3834
allowed, see [`phpstan/phpstan-strict-rules#87`](https://github.com/phpstan/phpstan-strict-rules/issues/87)
@@ -53,6 +49,22 @@ classes that extend or implement a certain class/interface
5349
1. `SlamPhpStan\AccessStaticPropertyWithinModelContextRule`: inhibit the access to static attributes of a class within
5450
classes that extend or implement a certain class/interface, useful to prohibit usage of singletons in models
5551

52+
## Symfony-specific config
53+
54+
A `symfony-rules.neon` config is present for Symfony projects:
55+
56+
```yaml
57+
includes:
58+
- vendor/slam/phpstan-extensions/conf/symfony-rules.neon
59+
```
60+
61+
With the following configurations:
62+
63+
1. `SlamPhpStan\SymfonyFilesystemRule`: forbid calls to raw filesystem functions well wrapped by
64+
[`symfony/filesystem`](https://github.com/symfony/filesystem) component
65+
1. `SlamPhpStan\SymfonyProcessRule`: forbid calls to raw system functions well wrapped by
66+
[`symfony/process`](https://github.com/symfony/process) component
67+
5668
## Yii-specific config
5769

5870
A `yii-rules.neon` config is present for Yii projects:

conf/slam-rules.neon

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,6 @@ services:
1919
class: SlamPhpStan\UnusedVariableRule
2020
tags:
2121
- phpstan.rules.rule
22-
-
23-
class: SlamPhpStan\SymfonyFilesystemRule
24-
tags:
25-
- phpstan.rules.rule
26-
-
27-
class: SlamPhpStan\SymfonyProcessRule
28-
tags:
29-
- phpstan.rules.rule
3022
-
3123
class: SlamPhpStan\MissingClosureParameterTypehintRule
3224
tags:

conf/symfony-rules.neon

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
services:
2+
-
3+
class: SlamPhpStan\SymfonyFilesystemRule
4+
tags:
5+
- phpstan.rules.rule
6+
-
7+
class: SlamPhpStan\SymfonyProcessRule
8+
tags:
9+
- phpstan.rules.rule

phpstan.neon

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ includes:
33
- vendor/phpstan/phpstan-phpunit/extension.neon
44
- vendor/phpstan/phpstan-php-parser/extension.neon
55
- conf/slam-rules.neon
6+
- conf/symfony-rules.neon
67
- conf/thecodingmachine-rules.neon
78

89
parameters:

0 commit comments

Comments
 (0)