Skip to content

Commit 335c16f

Browse files
committed
[BE] Always report always true conditions, except for last elseif and match arm
1 parent cc7ff8b commit 335c16f

File tree

4 files changed

+5
-8
lines changed

4 files changed

+5
-8
lines changed

changelog-2.0.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ Major new features 🚀
1616
* [Learn more on phpstan.org](https://phpstan.org/blog/enhancements-in-handling-parameters-passed-by-reference)
1717
* [#2941](https://github.com/phpstan/phpstan-src/pull/2941), thanks @ljmaskey!
1818
* Check too wide private property type (level 4) (https://github.com/phpstan/phpstan-src/commit/7453f4f75fae3d635063589467842aae29d88b54)
19+
* Always report always true conditions, except for last elseif and match arm (https://github.com/phpstan/phpstan-src/commit/565fb0f6da9cdc58e8686598015561a848693972)
1920
* Remove "unreachable branches" rules: UnreachableIfBranchesRule, UnreachableTernaryElseBranchRule, unreachable arm error in MatchExpressionRule
2021
* Because "always true" is always reported, these are no longer needed
2122
* LogicalXorConstantConditionRule (level 4) (https://github.com/phpstan/phpstan-src/commit/3a12724fd636b1bcf36c22b36e8f765d97150895, https://github.com/phpstan/phpstan-src/commit/3b011f6524254dad0f16840fdcfdbe7421548617), #7539
@@ -67,7 +68,6 @@ Bleeding edge (TODO move to other sections)
6768
* Support `@readonly` property and `@immutable` class PHPDoc ([#1295](https://github.com/phpstan/phpstan-src/pull/1295), [#1335](https://github.com/phpstan/phpstan-src/pull/1335)), #4082, thanks @herndlm!
6869
* Move IllegalConstructorMethodCallRule and IllegalConstructorStaticCallRule to phpstan-strict-rules (https://github.com/phpstan/phpstan-src/commit/124b30f98c182193187be0b9c2e151e477429b7a, https://github.com/phpstan/phpstan-strict-rules/commit/0c82c96f2a55d8b91bbc7ee6512c94f68a206b43)
6970
* Add `@readonly` rule that disallows default values ([#1391](https://github.com/phpstan/phpstan-src/pull/1391)), thanks @herndlm!
70-
* Always report always true conditions, except for last elseif and match arm ([#2105](https://github.com/phpstan/phpstan-src/pull/2105)), thanks @staabm!
7171
* Report narrowing `PHPStan\Type\Type` interface via `@var` (https://github.com/phpstan/phpstan-src/commit/713b98fb107213c28e3d8c8b4b43c5f5fc47c144), https://github.com/nunomaduro/larastan/issues/1567#issuecomment-1460445389
7272
* Check invalid PHPDocs in previously unchecked statement types (https://github.com/phpstan/phpstan-src/commit/9780d352f3264aac09ac7954f691de1877db8e01)
7373
* InvalidPHPStanDocTagRule in StubValidator (https://github.com/phpstan/phpstan-src/commit/9c2552b7e744926d1a74c1ba8fd32c64079eed61)

conf/bleedingEdge.neon

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,5 @@ parameters:
88
arrayValues: true
99
looseComparison: true
1010
readOnlyByPhpDoc: true
11-
alwaysTrueAlwaysReported: true
1211
pure: true
1312
requireFileExists: true

conf/config.neon

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,17 +29,16 @@ parameters:
2929
illegalConstructorMethodCall: false
3030
looseComparison: false
3131
readOnlyByPhpDoc: false
32-
alwaysTrueAlwaysReported: false
3332
stricterFunctionMap: false
3433
pure: false
3534
requireFileExists: false
3635
fileExtensions:
3736
- php
3837
checkAdvancedIsset: false
39-
checkAlwaysTrueCheckTypeFunctionCall: %featureToggles.alwaysTrueAlwaysReported%
40-
checkAlwaysTrueInstanceof: %featureToggles.alwaysTrueAlwaysReported%
41-
checkAlwaysTrueStrictComparison: %featureToggles.alwaysTrueAlwaysReported%
42-
checkAlwaysTrueLooseComparison: %featureToggles.alwaysTrueAlwaysReported%
38+
checkAlwaysTrueCheckTypeFunctionCall: true
39+
checkAlwaysTrueInstanceof: true
40+
checkAlwaysTrueStrictComparison: true
41+
checkAlwaysTrueLooseComparison: true
4342
reportAlwaysTrueInLastCondition: false
4443
checkClassCaseSensitivity: false
4544
checkExplicitMixed: false

conf/parametersSchema.neon

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ parametersSchema:
3535
illegalConstructorMethodCall: bool(),
3636
looseComparison: bool(),
3737
readOnlyByPhpDoc: bool()
38-
alwaysTrueAlwaysReported: bool()
3938
stricterFunctionMap: bool()
4039
pure: bool()
4140
requireFileExists: bool()

0 commit comments

Comments
 (0)