Skip to content

Commit 04e2b5f

Browse files
committed
[ci-review] Rector Rectify
1 parent a581fea commit 04e2b5f

8 files changed

Lines changed: 8 additions & 8 deletions

File tree

‎rules/DeadCode/Rector/TryCatch/RemoveDeadCatchRector.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ private function isJustThrownSameVariable(Catch_ $catch): bool
110110
}
111111

112112
$catchItemStmt = $catch->stmts[0];
113-
if (! ($catchItemStmt instanceof Expression && $catchItemStmt->expr instanceof Throw_)) {
113+
if (!$catchItemStmt instanceof Expression || !$catchItemStmt->expr instanceof Throw_) {
114114
return false;
115115
}
116116

‎rules/DeadCode/Rector/TryCatch/RemoveDeadTryCatchRector.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ public function refactor(Node $node): array|null|int
8787
}
8888

8989
$onlyCatchStmt = $onlyCatch->stmts[0];
90-
if (! ($onlyCatchStmt instanceof Expression && $onlyCatchStmt->expr instanceof Throw_)) {
90+
if (!$onlyCatchStmt instanceof Expression || !$onlyCatchStmt->expr instanceof Throw_) {
9191
return null;
9292
}
9393

‎rules/Php70/EregToPcreTransformer.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ private function processSquareBracket(string $s, int $i, int $l, string $cls, bo
234234
} else {
235235
$a = $s[$i];
236236
++$i;
237-
if ($a === '-' && ! $start && ! ($i < $l && $s[$i] === ']')) {
237+
if ($a === '-' && ! $start && ($i >= $l || $s[$i] !== ']')) {
238238
throw new InvalidEregException('"-" is invalid for the start character in the brackets');
239239
}
240240

‎rules/Php74/Rector/ArrayDimFetch/CurlyToSquareBracketArrayStringRector.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ private function isFollowedByCurlyBracket(File $file, ArrayDimFetch $arrayDimFet
7979

8080
if (isset($oldTokens[$endTokenPost]) && (string) $oldTokens[$endTokenPost] === '}') {
8181
$startTokenPos = $arrayDimFetch->getStartTokenPos();
82-
return ! (isset($oldTokens[$startTokenPos]) && (string) $oldTokens[$startTokenPos] === '${');
82+
return !isset($oldTokens[$startTokenPos]) || (string) $oldTokens[$startTokenPos] !== '${';
8383
}
8484

8585
return false;

‎rules/Php80/NodeAnalyzer/MatchSwitchAnalyzer.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ public function shouldSkipSwitch(Switch_ $switch, array $condAndExprs, ?Stmt $ne
7171
return false;
7272
}
7373

74-
return ! ($nextStmt instanceof Expression && $nextStmt->expr instanceof Throw_);
74+
return !$nextStmt instanceof Expression || !$nextStmt->expr instanceof Throw_;
7575
}
7676

7777
/**

‎rules/Php82/Rector/Encapsed/VariableInStringInterpolationFixerRector.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public function refactor(Node $node): ?Node
5656
$hasChanged = false;
5757

5858
foreach ($node->parts as $part) {
59-
if (! $part instanceof Variable && ! ($part instanceof ArrayDimFetch && $part->var instanceof Variable)) {
59+
if (! $part instanceof Variable && (!$part instanceof ArrayDimFetch || !$part->var instanceof Variable)) {
6060
continue;
6161
}
6262

‎rules/Removing/Rector/ClassMethod/ArgumentRemoverRector.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ private function removeByName(ClassMethod | StaticCall | MethodCall $node, int $
148148
return;
149149
}
150150

151-
if (! (isset($node->params[$position]) && $this->isName($node->params[$position], $name))) {
151+
if (!isset($node->params[$position]) || !$this->isName($node->params[$position], $name)) {
152152
return;
153153
}
154154

‎rules/TypeDeclaration/Rector/ClassMethod/StringReturnTypeFromStrictStringReturnsRector.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ private function hasAlwaysStringScalarReturn(array $returns): bool
134134
{
135135
return array_all(
136136
$returns,
137-
fn (Return_ $return): bool => ! (! $return->expr instanceof String_ && ! $return->expr instanceof InterpolatedString)
137+
fn (Return_ $return): bool => $return->expr instanceof String_ || $return->expr instanceof InterpolatedString
138138
);
139139
}
140140

0 commit comments

Comments
 (0)