Skip to content

Commit 18101c9

Browse files
committed
only return node if changed in UseSpecificWithMethodRector
1 parent ddb73ae commit 18101c9

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

rules/CodeQuality/Rector/MethodCall/UseSpecificWithMethodRector.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,8 @@ public function refactor(Node $node): ?Node
8888
return null;
8989
}
9090

91+
$hasChanged = false;
92+
9193
foreach ($node->getArgs() as $i => $argNode) {
9294
if (! $argNode->value instanceof MethodCall) {
9395
continue;
@@ -99,8 +101,13 @@ public function refactor(Node $node): ?Node
99101
}
100102

101103
$node->args[$i] = $methodCall->getArgs()[0];
104+
$hasChanged = true;
105+
}
106+
107+
if ($hasChanged) {
108+
return $node;
102109
}
103110

104-
return $node;
111+
return null;
105112
}
106113
}

0 commit comments

Comments
 (0)