Skip to content

Commit 21383d5

Browse files
authored
Merge branch 'main' into fix/phpstan-failing
2 parents 1cb0b2d + d5e8535 commit 21383d5

10 files changed

+17
-5
lines changed

src/Rector/ClassMethod/AddParentBootToModelClassMethodRector.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ public function refactor(Node $node): ?Node
115115
$parentStaticCallExpression = new Expression($staticCall);
116116

117117
$node->stmts = array_merge([$parentStaticCallExpression], (array) $node->stmts);
118+
$node->stmts = array_values($node->stmts);
118119

119120
return $node;
120121
}

src/Rector/ClassMethod/AddParentRegisterToEventServiceProviderRector.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ public function refactor(Node $node): ?Node
111111
$parentStaticCallExpression = new Expression($staticCall);
112112

113113
$node->stmts = array_merge([$parentStaticCallExpression], (array) $node->stmts);
114+
$node->stmts = array_values($node->stmts);
114115

115116
return $node;
116117
}

src/Rector/ClassMethod/MigrateToSimplifiedAttributeRector.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,13 @@ public function refactor(Node $node): ?Node
7777
}
7878
}
7979

80-
return $hasChanged
81-
? $node
82-
: null;
80+
if ($hasChanged) {
81+
$node->stmts = array_values($node->stmts);
8382

83+
return $node;
84+
}
85+
86+
return null;
8487
}
8588

8689
public function getRuleDefinition(): RuleDefinition

src/Rector/Class_/ModelCastsPropertyToCastsMethodRector.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ public function refactor(Node $node): ?Class_
100100
$method->addStmt(new Return_($stmt->props[0]->default));
101101
$methodNode = $method->getNode();
102102
$node->stmts[] = $methodNode;
103+
$node->stmts = array_values($node->stmts);
103104

104105
$this->restorePhpDoc($methodNode);
105106

src/Rector/Class_/PropertyDeferToDeferrableProviderToRector.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ public function refactor(Node $node): ?Node
8080
}
8181

8282
unset($node->stmts[array_search($deferProperty, $node->stmts, true)]);
83+
$node->stmts = array_values($node->stmts);
8384

8485
$node->implements[] = new FullyQualified('Illuminate\Contracts\Support\DeferrableProvider');
8586

src/Rector/Class_/RemoveModelPropertyFromFactoriesRector.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ public function refactor(Node $node): ?Node
7171
}
7272

7373
unset($node->stmts[$index]);
74+
$node->stmts = array_values($node->stmts);
7475

7576
break;
7677
}

src/Rector/Class_/UnifyModelDatesWithCastsRector.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ public function getNodeTypes(): array
7676
/**
7777
* @param Class_ $node
7878
*/
79-
public function refactor(Node $node)
79+
public function refactor(Node $node): ?Node
8080
{
8181
if (! $this->isObjectType($node, new ObjectType('Illuminate\Database\Eloquent\Model'))) {
8282
return null;
@@ -128,8 +128,9 @@ public function refactor(Node $node)
128128
}
129129

130130
unset($node->stmts[array_search($datesProperty, $node->stmts, true)]);
131+
$node->stmts = array_values($node->stmts);
131132

132-
return null;
133+
return $node;
133134
}
134135

135136
private function createCastsProperty(): Property

src/Rector/MethodCall/WhereToWhereLikeRector.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ public function refactor(Node $node): ?Node
125125

126126
// Remove the second argument (the 'like' operator)
127127
unset($node->args[1]);
128+
$node->args = array_values($node->args);
128129

129130
return $node;
130131
}

src/Rector/Namespace_/FactoryDefinitionRector.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@ public function refactor(Node $node): ?Node
141141
}
142142

143143
$node->stmts = array_merge($node->stmts, $factories);
144+
$node->stmts = array_values($node->stmts);
144145

145146
return $node;
146147
}

src/Rector/StaticCall/Redirect301ToPermanentRedirectRector.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ public function refactor(Node $node): ?Node
9696
}
9797

9898
unset($node->args[2]);
99+
$node->args = array_values($node->args);
99100

100101
$node->name = new Identifier('permanentRedirect');
101102

0 commit comments

Comments
 (0)