Skip to content

Commit ca7ab77

Browse files
committed
Reapply "Attempt to fix FNSR false positive about expr.resultUnused"
This reverts commit ba9d829.
1 parent e7eb961 commit ca7ab77

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
@@ -942,18 +942,14 @@ private function processStmtNode(
942942
$hasAssign = false;
943943
$currentScope = $scope;
944944
$result = $this->processExprNode($stmt, $stmt->expr, $scope, $storage, static function (Node $node, Scope $scope) use ($nodeCallback, $currentScope, &$hasAssign): void {
945-
$nodeCallback($node, $scope);
946-
if (!$node instanceof VariableAssignNode && !$node instanceof PropertyAssignNode) {
947-
return;
948-
}
949-
if ($scope->getAnonymousFunctionReflection() !== $currentScope->getAnonymousFunctionReflection()) {
950-
return;
951-
}
952-
if ($scope->getFunction() !== $currentScope->getFunction()) {
953-
return;
945+
if (
946+
($node instanceof VariableAssignNode || $node instanceof PropertyAssignNode)
947+
&& $scope->getAnonymousFunctionReflection() === $currentScope->getAnonymousFunctionReflection()
948+
&& $scope->getFunction() === $currentScope->getFunction()
949+
) {
950+
$hasAssign = true;
954951
}
955-
956-
$hasAssign = true;
952+
$nodeCallback($node, $scope);
957953
}, ExpressionContext::createTopLevel());
958954
$throwPoints = array_filter($result->getThrowPoints(), static fn ($throwPoint) => $throwPoint->isExplicit());
959955
if (

0 commit comments

Comments
 (0)