Skip to content

Commit 367e758

Browse files
committed
fix build
1 parent b8ee531 commit 367e758

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

src/Analyser/NodeScopeResolver.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3381,7 +3381,7 @@ static function (): void {
33813381
$result = $this->processExprNode($stmt, $expr->expr, $scope, $nodeCallback, $context->enterDeep());
33823382
$throwPoints = $result->getThrowPoints();
33833383
$impurePoints = $result->getImpurePoints();
3384-
$isAlwaysTerminating = true;
3384+
$isAlwaysTerminating = $result->isAlwaysTerminating();
33853385
$hasYield = $result->hasYield();
33863386

33873387
$exprType = $scope->getType($expr->expr);
@@ -3749,7 +3749,7 @@ static function (Node $node, Scope $scope) use ($nodeCallback): void {
37493749
$scope = $keyResult->getScope();
37503750
$throwPoints = $keyResult->getThrowPoints();
37513751
$impurePoints = array_merge($impurePoints, $keyResult->getImpurePoints());
3752-
$isAlwaysTerminating = $isAlwaysTerminating || $keyResult->isAlwaysTerminating();
3752+
$isAlwaysTerminating = $keyResult->isAlwaysTerminating();
37533753
}
37543754
if ($expr->value !== null) {
37553755
$valueResult = $this->processExprNode($stmt, $expr->value, $scope, $nodeCallback, $context->enterDeep());
@@ -4027,7 +4027,7 @@ static function (Node $node, Scope $scope) use ($nodeCallback): void {
40274027
$hasYield = $classResult->hasYield();
40284028
$throwPoints = $classResult->getThrowPoints();
40294029
$impurePoints = $classResult->getImpurePoints();
4030-
$isAlwaysTerminating = $isAlwaysTerminating || $classResult->isAlwaysTerminating();
4030+
$isAlwaysTerminating = $classResult->isAlwaysTerminating();
40314031
}
40324032
if ($expr->getName() instanceof Expr) {
40334033
$nameResult = $this->processExprNode($stmt, $expr->getName(), $scope, $nodeCallback, ExpressionContext::createDeep());
@@ -4048,7 +4048,7 @@ static function (Node $node, Scope $scope) use ($nodeCallback): void {
40484048
$hasYield = $classResult->hasYield();
40494049
$throwPoints = $classResult->getThrowPoints();
40504050
$impurePoints = $classResult->getImpurePoints();
4051-
$isAlwaysTerminating = $isAlwaysTerminating || $classResult->isAlwaysTerminating();
4051+
$isAlwaysTerminating = $classResult->isAlwaysTerminating();
40524052
}
40534053
} elseif ($expr instanceof Node\Scalar) {
40544054
$hasYield = false;

tests/PHPStan/Analyser/ExpressionResultTest.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@ public static function dataIsAlwaysTerminating(): array
3434
'$x ? "def" : "abc";',
3535
false,
3636
],
37+
[
38+
'(string) $x;',
39+
false,
40+
],
3741
[
3842
'sprintf("hello %s", exit());',
3943
true,

0 commit comments

Comments
 (0)