|
171 | 171 | use PHPStan\Type\ClosureType;
|
172 | 172 | use PHPStan\Type\Constant\ConstantArrayType;
|
173 | 173 | use PHPStan\Type\Constant\ConstantArrayTypeBuilder;
|
174 |
| -use PHPStan\Type\Constant\ConstantBooleanType; |
175 | 174 | use PHPStan\Type\Constant\ConstantIntegerType;
|
176 | 175 | use PHPStan\Type\Constant\ConstantStringType;
|
177 | 176 | use PHPStan\Type\ErrorType;
|
@@ -1091,7 +1090,7 @@ private function processStmtNode(
|
1091 | 1090 |
|
1092 | 1091 | $branchScopeStatementResult = $this->processStmtNodes($stmt, $stmt->stmts, $condResult->getTruthyScope(), $nodeCallback, $context);
|
1093 | 1092 |
|
1094 |
| - if (!$conditionType instanceof ConstantBooleanType || $conditionType->getValue()) { |
| 1093 | + if (!$conditionType->isTrue()->no()) { |
1095 | 1094 | $exitPoints = $branchScopeStatementResult->getExitPoints();
|
1096 | 1095 | $throwPoints = array_merge($throwPoints, $branchScopeStatementResult->getThrowPoints());
|
1097 | 1096 | $impurePoints = array_merge($impurePoints, $branchScopeStatementResult->getImpurePoints());
|
@@ -1123,13 +1122,8 @@ private function processStmtNode(
|
1123 | 1122 |
|
1124 | 1123 | if (
|
1125 | 1124 | !$ifAlwaysTrue
|
1126 |
| - && ( |
1127 |
| - !$lastElseIfConditionIsTrue |
1128 |
| - && ( |
1129 |
| - !$elseIfConditionType instanceof ConstantBooleanType |
1130 |
| - || $elseIfConditionType->getValue() |
1131 |
| - ) |
1132 |
| - ) |
| 1125 | + && !$lastElseIfConditionIsTrue |
| 1126 | + && !$elseIfConditionType->isTrue()->no() |
1133 | 1127 | ) {
|
1134 | 1128 | $exitPoints = array_merge($exitPoints, $branchScopeStatementResult->getExitPoints());
|
1135 | 1129 | $throwPoints = array_merge($throwPoints, $branchScopeStatementResult->getThrowPoints());
|
|
0 commit comments