Skip to content

Commit

Permalink
[EarlyReturn] Clena up equal node check on IfAndAnalyzer::isIfStmtExp…
Browse files Browse the repository at this point in the history
…rUsedInNextReturn() (#5710)
  • Loading branch information
samsonasik authored Mar 11, 2024
1 parent 2adeacc commit 8ade0b9
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions rules/EarlyReturn/NodeAnalyzer/IfAndAnalyzer.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,7 @@ public function isIfStmtExprUsedInNextReturn(If_ $if, Return_ $return): bool
$ifExprs = $this->betterNodeFinder->findInstanceOf($if->stmts, Expr::class);
return (bool) $this->betterNodeFinder->findFirst(
$return->expr,
function (Node $node) use ($ifExprs): bool {
foreach ($ifExprs as $ifExpr) {
if ($this->nodeComparator->areNodesEqual($node, $ifExpr)) {
return true;
}
}

return false;
}
fn (Node $node): bool => $this->nodeComparator->isNodeEqual($node, $ifExprs)
);
}
}

0 comments on commit 8ade0b9

Please sign in to comment.