Skip to content

Commit 124db83

Browse files
committed
Enabled always true comparisons already done by PHPStan
1 parent 4b174c4 commit 124db83

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

Diff for: README.md

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
* Types in `switch` condition and `case` value must match. PHP compares them loosely by default and that can lead to unexpected results.
1717
* Statically declared methods are called statically.
1818
* 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.
19+
* Always true `instanceof`, type-checking `is_*` functions and strict comparisons `===`/`!==`. These checks can be turned off by setting `checkAlwaysTrueInstanceof`/`checkAlwaysTrueCheckTypeFunctionCall`/`checkAlwaysTrueStrictComparison` to false.
1920

2021
Additional rules are coming in subsequent releases!
2122

Diff for: rules.neon

+3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
parameters:
22
polluteScopeWithLoopInitialAssignments: false
3+
checkAlwaysTrueCheckTypeFunctionCall: true
4+
checkAlwaysTrueInstanceof: true
5+
checkAlwaysTrueStrictComparison: true
36

47
rules:
58
- PHPStan\Rules\BooleansInConditions\BooleanInBooleanAndRule

0 commit comments

Comments
 (0)