diff --git a/rules-tests/Renaming/Rector/Name/RenameClassRector/Fixture/docblock_aliased_name.php.inc b/rules-tests/Renaming/Rector/Name/RenameClassRector/Fixture/docblock_aliased_name.php.inc new file mode 100644 index 00000000000..fff30953a6b --- /dev/null +++ b/rules-tests/Renaming/Rector/Name/RenameClassRector/Fixture/docblock_aliased_name.php.inc @@ -0,0 +1,21 @@ + +----- + diff --git a/rules-tests/Renaming/Rector/Name/RenameClassRector/Fixture/docblock_shortname.php.inc b/rules-tests/Renaming/Rector/Name/RenameClassRector/Fixture/docblock_shortname.php.inc new file mode 100644 index 00000000000..c2813918303 --- /dev/null +++ b/rules-tests/Renaming/Rector/Name/RenameClassRector/Fixture/docblock_shortname.php.inc @@ -0,0 +1,19 @@ + +----- + diff --git a/src/NodeTypeResolver/PhpDocNodeVisitor/ClassRenamePhpDocNodeVisitor.php b/src/NodeTypeResolver/PhpDocNodeVisitor/ClassRenamePhpDocNodeVisitor.php index de05b91f6b3..3630accd57f 100644 --- a/src/NodeTypeResolver/PhpDocNodeVisitor/ClassRenamePhpDocNodeVisitor.php +++ b/src/NodeTypeResolver/PhpDocNodeVisitor/ClassRenamePhpDocNodeVisitor.php @@ -22,6 +22,7 @@ use Rector\PhpDocParser\PhpDocParser\PhpDocNodeVisitor\AbstractPhpDocNodeVisitor; use Rector\Renaming\Collector\RenamedNameCollector; use Rector\StaticTypeMapper\StaticTypeMapper; +use Rector\StaticTypeMapper\ValueObject\Type\AliasedObjectType; use Rector\StaticTypeMapper\ValueObject\Type\ShortenedObjectType; final class ClassRenamePhpDocNodeVisitor extends AbstractPhpDocNodeVisitor @@ -134,8 +135,8 @@ private function resolveNamespacedName( return $name; } - if ($staticType instanceof ShortenedObjectType) { - return $name; + if ($staticType instanceof ShortenedObjectType || $staticType instanceof AliasedObjectType) { + return $staticType->getFullyQualifiedName(); } $uses = $this->useImportsResolver->resolve();