Skip to content

Commit

Permalink
Enabled always true comparisons already done by PHPStan
Browse files Browse the repository at this point in the history
  • Loading branch information
ondrejmirtes committed Mar 11, 2018
1 parent 4b174c4 commit 124db83
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
* Types in `switch` condition and `case` value must match. PHP compares them loosely by default and that can lead to unexpected results.
* Statically declared methods are called statically.
* Disallow `empty()` - it's a very loose comparison (see [manual](https://secure.php.net/manual/en/function.empty.php)), it's recommended to use more strict one.
* Always true `instanceof`, type-checking `is_*` functions and strict comparisons `===`/`!==`. These checks can be turned off by setting `checkAlwaysTrueInstanceof`/`checkAlwaysTrueCheckTypeFunctionCall`/`checkAlwaysTrueStrictComparison` to false.

Additional rules are coming in subsequent releases!

Expand Down
3 changes: 3 additions & 0 deletions rules.neon
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
parameters:
polluteScopeWithLoopInitialAssignments: false
checkAlwaysTrueCheckTypeFunctionCall: true
checkAlwaysTrueInstanceof: true
checkAlwaysTrueStrictComparison: true

rules:
- PHPStan\Rules\BooleansInConditions\BooleanInBooleanAndRule
Expand Down

0 comments on commit 124db83

Please sign in to comment.