diff --git a/rules-tests/TypeDeclaration/Rector/ClassMethod/KnownMagicClassMethodTypeRector/Fixture/skip_exists_in_parent.php.inc b/rules-tests/TypeDeclaration/Rector/ClassMethod/KnownMagicClassMethodTypeRector/Fixture/skip_exists_in_parent.php.inc new file mode 100644 index 00000000000..890a68ce4ad --- /dev/null +++ b/rules-tests/TypeDeclaration/Rector/ClassMethod/KnownMagicClassMethodTypeRector/Fixture/skip_exists_in_parent.php.inc @@ -0,0 +1,12 @@ +isName($classMethod, MethodName::CALL)) { - $firstParam = $classMethod->getParams()[0]; - if (! $firstParam->type instanceof Node) { - $firstParam->type = new Identifier('string'); - $hasChanged = true; - } + if (! $this->isName($classMethod, MethodName::CALL)) { + continue; + } + + if ($this->parentClassMethodTypeOverrideGuard->hasParentClassMethod($classMethod)) { + return null; + } + + $firstParam = $classMethod->getParams()[0]; + if (! $firstParam->type instanceof Node) { + $firstParam->type = new Identifier('string'); + $hasChanged = true; + } - $secondParam = $classMethod->getParams()[1]; - if (! $secondParam->type instanceof Node) { - $secondParam->type = new Name('array'); - $hasChanged = true; - } + $secondParam = $classMethod->getParams()[1]; + if (! $secondParam->type instanceof Node) { + $secondParam->type = new Name('array'); + $hasChanged = true; } }