Skip to content

Commit 5696c88

Browse files
committed
fix arrow-fn and suppress
1 parent 367e758 commit 5696c88

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

src/Analyser/NodeScopeResolver.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3185,7 +3185,7 @@ static function (): void {
31853185
return new ExpressionResult(
31863186
$result->getScope(),
31873187
$result->hasYield(),
3188-
false,
3188+
$result->isAlwaysTerminating(),
31893189
[],
31903190
[],
31913191
);
@@ -3194,7 +3194,7 @@ static function (): void {
31943194
$hasYield = $result->hasYield();
31953195
$throwPoints = $result->getThrowPoints();
31963196
$impurePoints = $result->getImpurePoints();
3197-
$isAlwaysTerminating = false;
3197+
$isAlwaysTerminating = $result->isAlwaysTerminating();
31983198
$scope = $result->getScope();
31993199
} elseif ($expr instanceof Exit_) {
32003200
$hasYield = false;
@@ -4792,7 +4792,7 @@ private function processArrowFunctionNode(
47924792
$nodeCallback(new InArrowFunctionNode($arrowFunctionType, $expr), $arrowFunctionScope);
47934793
$exprResult = $this->processExprNode($stmt, $expr->expr, $arrowFunctionScope, $nodeCallback, ExpressionContext::createTopLevel());
47944794

4795-
return new ExpressionResult($scope, false, false, $exprResult->getThrowPoints(), $exprResult->getImpurePoints());
4795+
return new ExpressionResult($scope, false, $exprResult->isAlwaysTerminating(), $exprResult->getThrowPoints(), $exprResult->getImpurePoints());
47964796
}
47974797

47984798
/**

tests/PHPStan/Analyser/ExpressionResultTest.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,10 @@ public static function dataIsAlwaysTerminating(): array
7474
'fn() => yield (exit());',
7575
true,
7676
],
77+
[
78+
'@exit();',
79+
true,
80+
],
7781
];
7882
}
7983

0 commit comments

Comments
 (0)