diff --git a/rules/TypeDeclaration/PHPStan/ObjectTypeSpecifier.php b/rules/TypeDeclaration/PHPStan/ObjectTypeSpecifier.php index beeac40a736..f9be3187c8e 100644 --- a/rules/TypeDeclaration/PHPStan/ObjectTypeSpecifier.php +++ b/rules/TypeDeclaration/PHPStan/ObjectTypeSpecifier.php @@ -10,7 +10,6 @@ use PhpParser\Node\Stmt\Use_; use PhpParser\Node\Stmt\UseUse; use PHPStan\Analyser\Scope; -use PHPStan\PhpDoc\Tag\TemplateTag; use PHPStan\Reflection\ClassReflection; use PHPStan\Reflection\ReflectionProvider; use PHPStan\Type\Generic\GenericObjectType; @@ -89,13 +88,11 @@ public function narrowToFullyQualifiedOrAliasedObjectType(Node $node, ObjectType // invalid type return new NonExistingObjectType($className); } - // only support single @template for now - if (\count($templateTags) !== 1) { + $currentTemplateTag = $templateTags[$className] ?? null; + if ($currentTemplateTag === null) { // invalid type return new NonExistingObjectType($className); } - /** @var TemplateTag $currentTemplateTag */ - $currentTemplateTag = \current($templateTags); return TemplateTypeFactory::create($templateTypeScope, $currentTemplateTag->getName(), $currentTemplateTag->getBound(), $currentTemplateTag->getVariance()); } } diff --git a/src/Application/VersionResolver.php b/src/Application/VersionResolver.php index f6ce9391006..e7559599982 100644 --- a/src/Application/VersionResolver.php +++ b/src/Application/VersionResolver.php @@ -19,12 +19,12 @@ final class VersionResolver * @api * @var string */ - public const PACKAGE_VERSION = '61a787e62541281bd5f3678fb2819d645c8f0055'; + public const PACKAGE_VERSION = '61ebcc53b5c50f244ce0f7dfb626ded8d371c0a5'; /** * @api * @var string */ - public const RELEASE_DATE = '2024-10-26 22:09:03'; + public const RELEASE_DATE = '2024-10-27 15:15:12'; /** * @var int */