Skip to content

Commit

Permalink
[ci-review] Rector Rectify
Browse files Browse the repository at this point in the history
  • Loading branch information
actions-user committed Apr 13, 2023
1 parent 562ad5a commit a83b74a
Showing 1 changed file with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -162,20 +162,20 @@ private function isUselessBooleanAnd(BooleanAnd $booleanAnd, Expr $foreachExpr):
return $this->countManipulator->isCounterHigherThanOne($booleanAnd->right, $foreachExpr);
}

private function refactorStmtsAware(StmtsAwareInterface $stmtsAware): ?StmtsAwareInterface
private function refactorStmtsAware(Node $node): ?StmtsAwareInterface
{
foreach ($stmtsAware->stmts as $key => $stmt) {
foreach ($node->stmts as $key => $stmt) {
if (! $stmt instanceof If_) {
continue;
}

$nextStmt = $stmtsAware->stmts[$key + 1] ?? null;
$nextStmt = $node->stmts[$key + 1] ?? null;
if (! $nextStmt instanceof Foreach_) {
continue;
}

// the foreach must be the last one
if (isset($stmtsAware->stmts[$key + 2])) {
if (isset($node->stmts[$key + 2])) {
continue;
}

Expand All @@ -186,8 +186,8 @@ private function refactorStmtsAware(StmtsAwareInterface $stmtsAware): ?StmtsAwar
continue;
}

unset($stmtsAware->stmts[$key]);
return $stmtsAware;
unset($node->stmts[$key]);
return $node;
}

return null;
Expand Down

0 comments on commit a83b74a

Please sign in to comment.