diff --git a/rules/PHPUnit80/Rector/MethodCall/SpecificAssertContainsRector.php b/rules/PHPUnit80/Rector/MethodCall/SpecificAssertContainsRector.php index 57b276b8..6a8bf9ca 100644 --- a/rules/PHPUnit80/Rector/MethodCall/SpecificAssertContainsRector.php +++ b/rules/PHPUnit80/Rector/MethodCall/SpecificAssertContainsRector.php @@ -94,6 +94,10 @@ public function refactor(Node $node): ?Node } $methodName = $this->getName($node->name); + if ($methodName === null) { + return null; + } + $newMethodName = self::OLD_TO_NEW_METHOD_NAMES[$methodName]; $node->name = new Identifier($newMethodName); diff --git a/rules/PHPUnit90/Rector/MethodCall/SpecificAssertContainsWithoutIdentityRector.php b/rules/PHPUnit90/Rector/MethodCall/SpecificAssertContainsWithoutIdentityRector.php index 66a220cc..1ea76c92 100644 --- a/rules/PHPUnit90/Rector/MethodCall/SpecificAssertContainsWithoutIdentityRector.php +++ b/rules/PHPUnit90/Rector/MethodCall/SpecificAssertContainsWithoutIdentityRector.php @@ -117,6 +117,10 @@ public function refactor(Node $node): ?Node /* here we search for element of array without identity check and we can replace functions */ $methodName = $this->getName($node->name); + if ($methodName === null) { + return null; + } + $node->name = new Identifier(self::OLD_METHODS_NAMES_TO_NEW_NAMES['string'][$methodName]); unset($node->args[3], $node->args[4]);