Skip to content

Commit ba9d829

Browse files
committed
Revert "Attempt to fix FNSR false positive about expr.resultUnused"
This reverts commit 196f44d.
1 parent 2c04455 commit ba9d829

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

src/Analyser/NodeScopeResolver.php

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -942,14 +942,18 @@ 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-
if (
946-
($node instanceof VariableAssignNode || $node instanceof PropertyAssignNode)
947-
&& $scope->getAnonymousFunctionReflection() === $currentScope->getAnonymousFunctionReflection()
948-
&& $scope->getFunction() === $currentScope->getFunction()
949-
) {
950-
$hasAssign = true;
951-
}
952945
$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;
954+
}
955+
956+
$hasAssign = true;
953957
}, ExpressionContext::createTopLevel());
954958
$throwPoints = array_filter($result->getThrowPoints(), static fn ($throwPoint) => $throwPoint->isExplicit());
955959
if (

0 commit comments

Comments
 (0)