diff --git a/src/PHPStanStaticTypeMapper/TypeMapper/ObjectTypeMapper.php b/src/PHPStanStaticTypeMapper/TypeMapper/ObjectTypeMapper.php index b0dc7d296d..6ed4ddb195 100644 --- a/src/PHPStanStaticTypeMapper/TypeMapper/ObjectTypeMapper.php +++ b/src/PHPStanStaticTypeMapper/TypeMapper/ObjectTypeMapper.php @@ -70,14 +70,10 @@ public function mapToPhpParserNode(Type $type, string $typeKind): ?Node return new Name('self'); } - if ($type instanceof ShortenedObjectType) { + if ($type instanceof ShortenedObjectType || $type instanceof AliasedObjectType) { return new FullyQualified($type->getFullyQualifiedName()); } - if ($type instanceof AliasedObjectType) { - return new Name($type->getClassName()); - } - if ($type instanceof FullyQualifiedObjectType) { $className = $type->getClassName();