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.
1414
1515When you are using [ ` phpstan/extension-installer ` ] ( https://github.com/phpstan/extension-installer ) , ` phpstan.neon ` will be automatically included.
1616
17- Otherwise add ` phpstan.neon ` to your Drupal project.
17+ <details >
18+ <summary >Manual installation</summary >
1819
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:
2021
21- ``` neon
22+ ```
2223includes:
23- - vendor/mglaman/phpstan-drupal/extension.neon
24+ - vendor/mglaman/phpstan-drupal/extension.neon
2425```
2526
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:
3128
3229```
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
3832```
33+ </details >
3934
4035## Excluding tests from analysis
4136
Original file line number Diff line number Diff line change 6464 },
6565 "phpstan" : {
6666 "includes" : [
67- " extension.neon"
67+ " extension.neon" ,
68+ " rules.neon"
6869 ]
6970 }
7071 },
Original file line number Diff line number Diff line change @@ -243,23 +243,6 @@ parametersSchema:
243243 ])
244244 ))
245245 ])
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
263246services :
264247 -
265248 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:
1515 class : Drupal\phpstan_fixtures\Entity\ContentEntityUsingDefaultStorage
1616includes :
1717 - ../../../extension.neon
18+ - ../../../rules.neon
1819 - ../../../vendor/phpstan/phpstan-deprecation-rules/rules.neon
You can’t perform that action at this time.
0 commit comments