Skip to content

Commit aa5568a

Browse files
committed
[ci-review] Rector Rectify
1 parent dadc8ed commit aa5568a

15 files changed

Lines changed: 18 additions & 18 deletions

rules/CodeQuality/Rector/BooleanOr/RepeatedOrEqualToInArrayRector.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public function getNodeTypes(): array
6666
public function refactor(Node $node): ?FuncCall
6767
{
6868
$identicals = $this->betterNodeFinder->findInstanceOf($node, Identical::class);
69-
$equals = $this->betterNodeFinder->findInstanceOf($node, Equal::class);
69+
$this->betterNodeFinder->findInstanceOf($node, Equal::class);
7070

7171
if (! $this->isEqualOrIdentical($node->right)) {
7272
return null;

rules/CodingStyle/Rector/Stmt/NewlineAfterStatementRector.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ private function resolveRangeLineFromComment(
186186
*/
187187
private function hasNoComment(?array $comments): bool
188188
{
189-
return $comments === null || $comments === [];
189+
return in_array($comments, [null, []], true);
190190
}
191191

192192
private function shouldSkip(Stmt $stmt): bool

rules/DeadCode/Rector/Assign/RemoveUnusedVariableAssignRector.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ public function getNodeTypes(): array
8282
public function refactor(Node $node): null|ClassMethod|Function_
8383
{
8484
$stmts = $node->stmts;
85-
if ($stmts === null || $stmts === []) {
85+
if (in_array($stmts, [null, []], true)) {
8686
return null;
8787
}
8888

rules/DeadCode/Rector/ClassMethod/RemoveUselessAssignFromPropertyPromotionRector.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public function refactor(Node $node): ?Node
6666
return null;
6767
}
6868

69-
if ($node->stmts === null || $node->stmts == []) {
69+
if (in_array($node->stmts, [null, []], true)) {
7070
return null;
7171
}
7272

rules/DeadCode/Rector/FunctionLike/RemoveDeadReturnRector.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ public function getNodeTypes(): array
7474
*/
7575
public function refactor(Node $node): ?Node
7676
{
77-
if ($node->stmts === [] || $node->stmts === null) {
77+
if (in_array($node->stmts, [[], null], true)) {
7878
return null;
7979
}
8080

rules/Php70/EregToPcreTransformer.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ private function _ere2pcre(string $content, int $i): array
136136
$r[$rr] .= '[' . $cls . ']';
137137
} elseif ($char === ')') {
138138
break;
139-
} elseif ($char === '*' || $char === '+' || $char === '?') {
139+
} elseif (in_array($char, ['*', '+', '?'], true)) {
140140
throw new InvalidEregException('unescaped metacharacter "' . $char . '"');
141141
} elseif ($char === '{') {
142142
if ($i + 1 < $l && \str_contains('0123456789', $content[$i + 1])) {
@@ -146,7 +146,7 @@ private function _ere2pcre(string $content, int $i): array
146146
}
147147
} elseif ($char === '.') {
148148
$r[$rr] .= $char;
149-
} elseif ($char === '^' || $char === '$') {
149+
} elseif (in_array($char, ['^', '$'], true)) {
150150
$r[$rr] .= $char;
151151
++$i;
152152
continue;
@@ -177,7 +177,7 @@ private function _ere2pcre(string $content, int $i): array
177177

178178
// piece after the atom (only ONE of them is possible)
179179
$char = $content[$i];
180-
if ($char === '*' || $char === '+' || $char === '?') {
180+
if (in_array($char, ['*', '+', '?'], true)) {
181181
$r[$rr] .= $char;
182182
++$i;
183183
} elseif ($char === '{') {

rules/Php81/Rector/ClassMethod/NewInInitializerRector.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ public function getNodeTypes(): array
8181
*/
8282
public function refactor(Node $node): ?Node
8383
{
84-
if ($node->stmts === null || $node->stmts === []) {
84+
if (in_array($node->stmts, [null, []], true)) {
8585
return null;
8686
}
8787

@@ -194,7 +194,7 @@ private function processPropertyPromotion(Class_ $class, Param $param, string $p
194194
private function matchConstructorParams(ClassMethod $classMethod): array
195195
{
196196
// skip empty constructor assigns, as we need those here
197-
if ($classMethod->stmts === null || $classMethod->stmts === []) {
197+
if (in_array($classMethod->stmts, [null, []], true)) {
198198
return [];
199199
}
200200

rules/Php83/Rector/ClassMethod/AddOverrideAttributeToOverriddenMethodsRector.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ private function shouldSkipParentClassMethod(ClassReflection $parentClassReflect
267267
}
268268

269269
// has any stmts?
270-
if ($parentClassMethod->stmts === null || $parentClassMethod->stmts === []) {
270+
if (in_array($parentClassMethod->stmts, [null, []], true)) {
271271
return true;
272272
}
273273

rules/TypeDeclaration/Rector/ClassMethod/NumericReturnTypeFromStrictReturnsRector.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ private function shouldSkip(ClassMethod|Function_ $functionLike, Scope $scope):
136136
}
137137

138138
// empty, nothing to find
139-
if ($functionLike->stmts === null || $functionLike->stmts === []) {
139+
if (in_array($functionLike->stmts, [null, []], true)) {
140140
return true;
141141
}
142142

rules/TypeDeclaration/Rector/ClassMethod/NumericReturnTypeFromStrictScalarReturnsRector.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ private function shouldSkip(ClassMethod|Function_ $functionLike, Scope $scope):
129129
}
130130

131131
// empty, nothing to find
132-
if ($functionLike->stmts === null || $functionLike->stmts === []) {
132+
if (in_array($functionLike->stmts, [null, []], true)) {
133133
return true;
134134
}
135135

0 commit comments

Comments
 (0)