Skip to content

Commit 3de6708

Browse files
committed
fix arrow-fn and suppress
1 parent 6daf17c commit 3de6708

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
@@ -3187,7 +3187,7 @@ static function (): void {
31873187
return new ExpressionResult(
31883188
$result->getScope(),
31893189
$result->hasYield(),
3190-
false,
3190+
$result->isAlwaysTerminating(),
31913191
[],
31923192
[],
31933193
);
@@ -3196,7 +3196,7 @@ static function (): void {
31963196
$hasYield = $result->hasYield();
31973197
$throwPoints = $result->getThrowPoints();
31983198
$impurePoints = $result->getImpurePoints();
3199-
$isAlwaysTerminating = false;
3199+
$isAlwaysTerminating = $result->isAlwaysTerminating();
32003200
$scope = $result->getScope();
32013201
} elseif ($expr instanceof Exit_) {
32023202
$hasYield = false;
@@ -4794,7 +4794,7 @@ private function processArrowFunctionNode(
47944794
$nodeCallback(new InArrowFunctionNode($arrowFunctionType, $expr), $arrowFunctionScope);
47954795
$exprResult = $this->processExprNode($stmt, $expr->expr, $arrowFunctionScope, $nodeCallback, ExpressionContext::createTopLevel());
47964796

4797-
return new ExpressionResult($scope, false, false, $exprResult->getThrowPoints(), $exprResult->getImpurePoints());
4797+
return new ExpressionResult($scope, false, $exprResult->isAlwaysTerminating(), $exprResult->getThrowPoints(), $exprResult->getImpurePoints());
47984798
}
47994799

48004800
/**

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)