Skip to content

Commit

Permalink
clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
samsonasik committed Jul 20, 2024
1 parent f937ddd commit b429662
Showing 1 changed file with 13 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,10 @@ public function refactor(Node $node): ?Node
continue;
}

if (! $this->isArrayType($stmt->expr)) {
continue;
}

// special case of nested array items
if ($stmt->valueVar instanceof Array_) {
$valueArray = $this->refactorArrayForeachValue($stmt->valueVar, $stmt);
Expand All @@ -113,23 +117,19 @@ public function refactor(Node $node): ?Node
continue;
}

if ($stmt->valueVar instanceof Variable) {
if ($this->isVariableUsedInForeach($stmt->valueVar, $stmt)) {
continue;
}
if (! $stmt->valueVar instanceof Variable) {
continue;
}

if ($this->stmtsManipulator->isVariableUsedInNextStmt(
$stmts,
$key + 1,
(string) $this->getName($stmt->valueVar)
)) {
continue;
}
} else {
if ($this->isVariableUsedInForeach($stmt->valueVar, $stmt)) {
continue;
}

if (! $this->isArrayType($stmt->expr)) {
if ($this->stmtsManipulator->isVariableUsedInNextStmt(
$stmts,
$key + 1,
(string) $this->getName($stmt->valueVar)
)) {
continue;
}

Expand Down

0 comments on commit b429662

Please sign in to comment.