Skip to content

Commit 47b03fb

Browse files
nelson6e65ondrejmirtes
authored andcommitted
docs(readme): improve "Enabling rules one-by-one"
Add note about allowing some rules alternatively by using `ignoreErrors` option when `phpstan/extension-installer` is installed.
1 parent 38008d0 commit 47b03fb

File tree

1 file changed

+18
-3
lines changed

1 file changed

+18
-3
lines changed

README.md

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,13 @@ includes:
5858

5959
## Enabling rules one-by-one
6060

61-
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 the whole `rules.neon` from this package in your configuration, but look at its contents and copy only the rules you want to your configuration under the `services` key:
61+
If you don't want to start using all the available strict rules at once but only one or two, you can!
6262

63-
```
63+
### Without extension-installer
64+
65+
Just don't include the whole `rules.neon` from this package in your configuration, but look at its contents and copy only the rules you want to your configuration under the `services` key:
66+
67+
```neon
6468
services:
6569
-
6670
class: PHPStan\Rules\StrictCalls\StrictFunctionCallsRule
@@ -73,4 +77,15 @@ services:
7377
- phpstan.rules.rule
7478
```
7579

76-
*Unfortunately, you cannot use phpstan/extension-installer in this case.*
80+
### With extension-installer
81+
82+
Unfortunately, by using `phpstan/extension-installer` you can't enable it one by one, ***but you can [ignore specific errors](https://phpstan.org/user-guide/ignoring-errors) instead***.
83+
84+
For example:
85+
86+
```neon
87+
parameters:
88+
ignoreErrors:
89+
- '#Construct empty\(\) is not allowed. Use more strict comparison.#'
90+
- '#Call to function in_array\(\) requires parameter \#3 to be set.#'
91+
```

0 commit comments

Comments
 (0)