Skip to content

Commit 196f44d

Browse files
committed
Attempt to fix FNSR false positive about expr.resultUnused
1 parent 60d751f commit 196f44d

File tree

1 file changed

+7
-11
lines changed

1 file changed

+7
-11
lines changed

src/Analyser/NodeScopeResolver.php

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -948,18 +948,14 @@ private function processStmtNode(
948948
$hasAssign = false;
949949
$currentScope = $scope;
950950
$result = $this->processExprNode($stmt, $stmt->expr, $scope, $storage, static function (Node $node, Scope $scope) use ($nodeCallback, $currentScope, &$hasAssign): void {
951-
$nodeCallback($node, $scope);
952-
if (!$node instanceof VariableAssignNode && !$node instanceof PropertyAssignNode) {
953-
return;
954-
}
955-
if ($scope->getAnonymousFunctionReflection() !== $currentScope->getAnonymousFunctionReflection()) {
956-
return;
957-
}
958-
if ($scope->getFunction() !== $currentScope->getFunction()) {
959-
return;
951+
if (
952+
($node instanceof VariableAssignNode || $node instanceof PropertyAssignNode)
953+
&& $scope->getAnonymousFunctionReflection() === $currentScope->getAnonymousFunctionReflection()
954+
&& $scope->getFunction() === $currentScope->getFunction()
955+
) {
956+
$hasAssign = true;
960957
}
961-
962-
$hasAssign = true;
958+
$nodeCallback($node, $scope);
963959
}, ExpressionContext::createTopLevel());
964960
$throwPoints = array_filter($result->getThrowPoints(), static fn ($throwPoint) => $throwPoint->isExplicit());
965961
if (

0 commit comments

Comments
 (0)