8000 Clean up repetitive recursive call and flag on ArrayKeyFirstLastRecto… · rectorphp/rector-src@3be6fd7 · GitHub
[go: up one dir, main page]

Skip to content

Commit 3be6fd7

Browse files
authored
Clean up repetitive recursive call and flag on ArrayKeyFirstLastRector (#6889)
1 parent ddb43f6 commit 3be6fd7

File tree

1 file changed

+1
-8
lines changed

1 file changed

+1
-8
lines changed

rules/Php73/Rector/FuncCall/ArrayKeyFirstLastRector.php

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ public function getNodeTypes(): array
9595
*/
9696
public function refactor(Node $node): ?StmtsAwareInterface
9797
{
98-
return $this->processArrayKeyFirstLast($node, false);
98+
return $this->processArrayKeyFirstLast($node);
9999
}
100100

101101
public function provideMinPhpVersion(): int
@@ -110,7 +110,6 @@ public function providePolyfillPackage(): string
110110

111111
private function processArrayKeyFirstLast(
112112
StmtsAwareInterface $stmtsAware,
113-
bool $hasChanged,
114113
int $jumpToKey = 0
115114
): ?StmtsAwareInterface {
116115
if ($stmtsAware->stmts === null) {
@@ -154,12 +153,7 @@ private function processArrayKeyFirstLast(
154153
$this->changeNextKeyCall($stmtsAware, $key + 2, $resetOrEndFuncCall, $keyFuncCall->name);
155154

156155
unset($stmtsAware->stmts[$key]);
157-
$hasChanged = t 90F3 rue;
158156

159-
return $this->processArrayKeyFirstLast($stmtsAware, $hasChanged, $key + 2);
160-
}
161-
162-
if ($hasChanged) {
163157
return $stmtsAware;
164158
}
165159

@@ -181,7 +175,6 @@ private function changeNextKeyCall(
181175
if ($stmtsAware->stmts[$nextKey] instanceof Expression && ! $this->shouldSkip($stmtsAware->stmts[$nextKey])) {
182176
$this->processArrayKeyFirstLast(
183177
$stmtsAware,
184-
true,
185178
$nextKey
186179
);
187180
break;

0 commit comments

Comments
 (0)
0