diff --git a/rules/CodeQuality/Rector/MethodCall/AssertCompareOnCountableWithMethodToAssertCountRector.php b/rules/CodeQuality/Rector/MethodCall/AssertCompareOnCountableWithMethodToAssertCountRector.php index 7a051be9..e9243d63 100644 --- a/rules/CodeQuality/Rector/MethodCall/AssertCompareOnCountableWithMethodToAssertCountRector.php +++ b/rules/CodeQuality/Rector/MethodCall/AssertCompareOnCountableWithMethodToAssertCountRector.php @@ -110,6 +110,8 @@ public function refactor(Node $node): MethodCall|StaticCall|null $node->args = $args; $this->renameMethod($node); + + return $node; } } diff --git a/rules/PHPUnit80/Rector/MethodCall/AssertEqualsParameterToSpecificMethodsTypeRector.php b/rules/PHPUnit80/Rector/MethodCall/AssertEqualsParameterToSpecificMethodsTypeRector.php index 409f807d..6e28dc5d 100644 --- a/rules/PHPUnit80/Rector/MethodCall/AssertEqualsParameterToSpecificMethodsTypeRector.php +++ b/rules/PHPUnit80/Rector/MethodCall/AssertEqualsParameterToSpecificMethodsTypeRector.php @@ -117,12 +117,19 @@ public function refactor(Node $node): ?Node return $newMethodCall; } + $hasChanged = false; if (isset($node->args[4])) { // add new node only in case of non-default value unset($node->args[4]); + $hasChanged = true; } - return $this->processAssertEqualsWithDelta($node); + $newMethodCall = $this->processAssertEqualsWithDelta($node); + if ($newMethodCall !== null) { + return $newMethodCall; + } + + return $hasChanged ? $node : null; } /** @@ -203,7 +210,8 @@ private function processAssertEqualsWithDelta(MethodCall|StaticCall $call): Meth unset($call->args[3]); if ($this->valueResolver->isValue($thirdArg->value, 0.0)) { - return null; + // default delta removed in place, no dedicated method needed + return $call; } $newMethodCall = $this->assertCallFactory->createCallWithName($call, 'assertEqualsWithDelta');