@@ -17,8 +17,8 @@ includes:
17
17
18
18
## Enabling rules one-by-one
19
19
20
- 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
21
- the whole ` rules.neon ` from this package in your configuration, but look at its contents and copy only the rules you
20
+ 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
21
+ the whole ` rules.neon ` from this package in your configuration, but look at its contents and copy only the rules you
22
22
want to your configuration under the ` services ` key:
23
23
24
24
```
@@ -40,11 +40,44 @@ parameters:
40
40
- *TestBase.php
41
41
```
42
42
43
+ ## Deprecation testing
44
+
45
+ Add the deprecation rules to your Drupal project's dependencies
46
+
47
+ ```
48
+ composer require phpstan/phpstan-deprecation-rules
49
+ ```
50
+
51
+ Edit your ` phpstan.neon ` to look like the following:
52
+
53
+ ```
54
+ includes:
55
+ - vendor/mglaman/phpstan-drupal/extension.neon
56
+ - vendor/phpstan/phpstan-deprecation-rules/rules.neon
57
+ ```
58
+
59
+ To only handle deprecation testing, use a ` phpstan.neon ` like this:
60
+
61
+ ```
62
+ parameters:
63
+ customRulesetUsed: true
64
+ reportUnmatchedIgnoredErrors: false
65
+ # Ignore phpstan-drupal extension's rules.
66
+ ignoreErrors:
67
+ - '#\Drupal calls should be avoided in classes, use dependency injection instead#'
68
+ - '#Plugin definitions cannot be altered.#'
69
+ - '#Missing cache backend declaration for performance.#'
70
+ - '#Plugin manager has cache backend specified but does not declare cache tags.#'
71
+ includes:
72
+ - vendor/mglaman/phpstan-drupal/extension.neon
73
+ - vendor/phpstan/phpstan-deprecation-rules/rules.neon
74
+ ```
75
+
43
76
## Adapting to your project
44
77
45
78
### Entity storage mappings.
46
79
47
- The ` EntityTypeManagerGetStorageDynamicReturnTypeExtension ` service helps map dynamic return types. This inspects the
80
+ The ` EntityTypeManagerGetStorageDynamicReturnTypeExtension ` service helps map dynamic return types. This inspects the
48
81
passed entity type ID and tries to return a known storage class, besides the default ` EntityStorageInterface ` . The
49
82
default mapping can be found in ` extension.neon ` . For example:
50
83
0 commit comments