Skip to content

Commit 9a6a85b

Browse files
authored
Clean up reset expression variable (#215)
1 parent e477635 commit 9a6a85b

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

rules/DowngradePhp73/Rector/FuncCall/DowngradeArrayKeyFirstLastRector.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -216,12 +216,10 @@ private function refactorArrayKeyLast(
216216

217217
$resetExpression = new Expression($this->nodeFactory->createFuncCall('reset', [$array]));
218218

219-
if (! $stmt instanceof StmtsAwareInterface && ! $stmt instanceof Return_) {
220-
$newStmts[] = new Expression($this->nodeFactory->createFuncCall('reset', [$array]));
221-
}
222-
223219
if ($stmt instanceof StmtsAwareInterface) {
224220
$stmt->stmts = array_merge([$resetExpression], $stmt->stmts);
221+
} elseif (! $stmt instanceof Return_) {
222+
$newStmts[] = $resetExpression;
225223
}
226224

227225
return $newStmts;

0 commit comments

Comments
 (0)