Skip to content

Commit 15be909

Browse files
committed
Updated README
1 parent 3f646d7 commit 15be909

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
* Require booleans in `if`, `elseif`, ternary operator, after `!`, and on both sides of `&&` and `||`.
1010
* Functions `in_array` and `array_search` must be called with third parameter `$strict` set to `true` to search values with matching types only.
1111
* Variables assigned in `while` loop condition and `for` loop initial assignment cannot be used after the loop.
12+
* Types in `switch` condition and `case` value must match. PHP compares them loosely by default and that can lead to unexpected results.
1213

1314
Additional rules are coming in subsequent releases!
1415

@@ -26,3 +27,19 @@ And include rules.neon in your project's PHPStan config:
2627
includes:
2728
- vendor/phpstan/phpstan-strict-rules/rules.neon
2829
```
30+
31+
## Enabling rules one-by-one
32+
33+
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:
34+
35+
```
36+
-
37+
class: PHPStan\Rules\StrictCalls\StrictFunctionCallsRule
38+
tags:
39+
- phpstan.rules.rule
40+
41+
-
42+
class: PHPStan\Rules\SwitchConditions\MatchingTypeInSwitchCaseConditionRule
43+
tags:
44+
- phpstan.rules.rule
45+
```

0 commit comments

Comments
 (0)