Skip to content

Commit

Permalink
Updated Rector to commit 2adeacc410de9304137574d2e80cf97c9f67dfa5
Browse files Browse the repository at this point in the history
rectorphp/rector-src@2adeacc [Performance]EarlyReturn] Reduce repetitive findFirst() on IfAndAnalyzer::isIfStmtExprUsedInNextReturn() (#5709)
  • Loading branch information
TomasVotruba committed Mar 11, 2024
1 parent 8201d0f commit 4026ff1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
15 changes: 7 additions & 8 deletions rules/EarlyReturn/NodeAnalyzer/IfAndAnalyzer.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,13 @@ public function isIfStmtExprUsedInNextReturn(If_ $if, Return_ $return) : bool
return \false;
}
$ifExprs = $this->betterNodeFinder->findInstanceOf($if->stmts, Expr::class);
foreach ($ifExprs as $ifExpr) {
$isExprFoundInReturn = (bool) $this->betterNodeFinder->findFirst($return->expr, function (Node $node) use($ifExpr) : bool {
return $this->nodeComparator->areNodesEqual($node, $ifExpr);
});
if ($isExprFoundInReturn) {
return \true;
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;
return \false;
});
}
}
4 changes: 2 additions & 2 deletions src/Application/VersionResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ final class VersionResolver
* @api
* @var string
*/
public const PACKAGE_VERSION = '57894303baab2e24a24387b48c5e94963e78ad26';
public const PACKAGE_VERSION = '2adeacc410de9304137574d2e80cf97c9f67dfa5';
/**
* @api
* @var string
*/
public const RELEASE_DATE = '2024-03-11 00:09:51';
public const RELEASE_DATE = '2024-03-11 09:10:24';
/**
* @var int
*/
Expand Down

0 comments on commit 4026ff1

Please sign in to comment.