Skip to content

Commit

Permalink
Updated README
Browse files Browse the repository at this point in the history
  • Loading branch information
ondrejmirtes committed Nov 26, 2017
1 parent 3f646d7 commit 15be909
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
* Require booleans in `if`, `elseif`, ternary operator, after `!`, and on both sides of `&&` and `||`.
* Functions `in_array` and `array_search` must be called with third parameter `$strict` set to `true` to search values with matching types only.
* Variables assigned in `while` loop condition and `for` loop initial assignment cannot be used after the loop.
* Types in `switch` condition and `case` value must match. PHP compares them loosely by default and that can lead to unexpected results.

Additional rules are coming in subsequent releases!

Expand All @@ -26,3 +27,19 @@ And include rules.neon in your project's PHPStan config:
includes:
- vendor/phpstan/phpstan-strict-rules/rules.neon
```

## Enabling rules one-by-one

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:

```
-
class: PHPStan\Rules\StrictCalls\StrictFunctionCallsRule
tags:
- phpstan.rules.rule
-
class: PHPStan\Rules\SwitchConditions\MatchingTypeInSwitchCaseConditionRule
tags:
- phpstan.rules.rule
```

0 comments on commit 15be909

Please sign in to comment.