File tree Expand file tree Collapse file tree 5 files changed +29
-32
lines changed Expand file tree Collapse file tree 5 files changed +29
-32
lines changed Original file line number Diff line number Diff line change @@ -14,28 +14,23 @@ Extension for [PHPStan](https://phpstan.org/) to allow analysis of Drupal code.
14
14
15
15
When you are using [ ` phpstan/extension-installer ` ] ( https://github.com/phpstan/extension-installer ) , ` phpstan.neon ` will be automatically included.
16
16
17
- Otherwise add ` phpstan.neon ` to your Drupal project.
17
+ <details >
18
+ <summary >Manual installation</summary >
18
19
19
- Make sure it has
20
+ If you don't want to use ` phpstan/extension-installer ` , include ` extension.neon ` in your project's PHPStan config:
20
21
21
- ``` neon
22
+ ```
22
23
includes:
23
- - vendor/mglaman/phpstan-drupal/extension.neon
24
+ - vendor/mglaman/phpstan-drupal/extension.neon
24
25
```
25
26
26
- ## Enabling rules one-by-one
27
-
28
- If you don't want to start using all the available strict rules at once but only one or two, you can! Just don't include
29
- the whole ` rules.neon ` from this package in your configuration, but look at its contents and copy only the rules you
30
- want to your configuration under the ` services ` key:
27
+ To include Drupal specific analysis rules, include this file:
31
28
32
29
```
33
- services:
34
- -
35
- class: PHPStan\Rules\Drupal\PluginManager\PluginManagerSetsCacheBackendRule
36
- tags:
37
- - phpstan.rules.rule
30
+ includes:
31
+ - vendor/mglaman/phpstan-drupal/rules.neon
38
32
```
33
+ </details >
39
34
40
35
## Excluding tests from analysis
41
36
Original file line number Diff line number Diff line change 64
64
},
65
65
"phpstan" : {
66
66
"includes" : [
67
- " extension.neon"
67
+ " extension.neon" ,
68
+ " rules.neon"
68
69
]
69
70
}
70
71
},
Original file line number Diff line number Diff line change @@ -243,23 +243,6 @@ parametersSchema:
243
243
])
244
244
))
245
245
])
246
- rules :
247
- - mglaman\PHPStanDrupal\Rules\Drupal\Coder\DiscouragedFunctionsRule
248
- - mglaman\PHPStanDrupal\Rules\Drupal\GlobalDrupalDependencyInjectionRule
249
- - mglaman\PHPStanDrupal\Rules\Drupal\PluginManager\PluginManagerSetsCacheBackendRule
250
- - mglaman\PHPStanDrupal\Rules\Deprecations\AccessDeprecatedConstant
251
- - mglaman\PHPStanDrupal\Rules\Classes\ClassExtendsInternalClassRule
252
- - mglaman\PHPStanDrupal\Rules\Classes\PluginManagerInspectionRule
253
- - mglaman\PHPStanDrupal\Rules\Deprecations\ConditionManagerCreateInstanceContextConfigurationRule
254
- - mglaman\PHPStanDrupal\Rules\Drupal\RenderCallbackRule
255
- - mglaman\PHPStanDrupal\Rules\Deprecations\StaticServiceDeprecatedServiceRule
256
- - mglaman\PHPStanDrupal\Rules\Deprecations\GetDeprecatedServiceRule
257
- - mglaman\PHPStanDrupal\Rules\Drupal\Tests\BrowserTestBaseDefaultThemeRule
258
- - mglaman\PHPStanDrupal\Rules\Deprecations\ConfigEntityConfigExportRule
259
- - mglaman\PHPStanDrupal\Rules\Deprecations\PluginAnnotationContextDefinitionsRule
260
- - mglaman\PHPStanDrupal\Rules\Drupal\ModuleLoadInclude
261
- - mglaman\PHPStanDrupal\Rules\Drupal\LoadIncludes
262
- - mglaman\PHPStanDrupal\Rules\Drupal\EntityQuery\EntityQueryHasAccessCheckRule
263
246
services :
264
247
-
265
248
class : mglaman\PHPStanDrupal\Drupal\ServiceMap
Original file line number Diff line number Diff line change
1
+ rules :
2
+ - mglaman\PHPStanDrupal\Rules\Drupal\Coder\DiscouragedFunctionsRule
3
+ - mglaman\PHPStanDrupal\Rules\Drupal\GlobalDrupalDependencyInjectionRule
4
+ - mglaman\PHPStanDrupal\Rules\Drupal\PluginManager\PluginManagerSetsCacheBackendRule
5
+ - mglaman\PHPStanDrupal\Rules\Deprecations\AccessDeprecatedConstant
6
+ - mglaman\PHPStanDrupal\Rules\Classes\ClassExtendsInternalClassRule
7
+ - mglaman\PHPStanDrupal\Rules\Classes\PluginManagerInspectionRule
8
+ - mglaman\PHPStanDrupal\Rules\Deprecations\ConditionManagerCreateInstanceContextConfigurationRule
9
+ - mglaman\PHPStanDrupal\Rules\Drupal\RenderCallbackRule
10
+ - mglaman\PHPStanDrupal\Rules\Deprecations\StaticServiceDeprecatedServiceRule
11
+ - mglaman\PHPStanDrupal\Rules\Deprecations\GetDeprecatedServiceRule
12
+ - mglaman\PHPStanDrupal\Rules\Drupal\Tests\BrowserTestBaseDefaultThemeRule
13
+ - mglaman\PHPStanDrupal\Rules\Deprecations\ConfigEntityConfigExportRule
14
+ - mglaman\PHPStanDrupal\Rules\Deprecations\PluginAnnotationContextDefinitionsRule
15
+ - mglaman\PHPStanDrupal\Rules\Drupal\ModuleLoadInclude
16
+ - mglaman\PHPStanDrupal\Rules\Drupal\LoadIncludes
17
+ - mglaman\PHPStanDrupal\Rules\Drupal\EntityQuery\EntityQueryHasAccessCheckRule
Original file line number Diff line number Diff line change @@ -15,4 +15,5 @@ parameters:
15
15
class : Drupal\phpstan_fixtures\Entity\ContentEntityUsingDefaultStorage
16
16
includes :
17
17
- ../../../extension.neon
18
+ - ../../../rules.neon
18
19
- ../../../vendor/phpstan/phpstan-deprecation-rules/rules.neon
You can’t perform that action at this time.
0 commit comments