diff --git a/rules/TypeDeclaration/Rector/Class_/ChildDoctrineRepositoryClassTypeRector.php b/rules/TypeDeclaration/Rector/Class_/ChildDoctrineRepositoryClassTypeRector.php index 65305fc818d..f2aba0ef6ef 100644 --- a/rules/TypeDeclaration/Rector/Class_/ChildDoctrineRepositoryClassTypeRector.php +++ b/rules/TypeDeclaration/Rector/Class_/ChildDoctrineRepositoryClassTypeRector.php @@ -155,6 +155,10 @@ CODE_SAMPLE if (!$entityGenericType instanceof IdentifierTypeNode) { return null; } + // skip if value is used in generics + if (\in_array($entityGenericType->name, $classPhpDocInfo->getTemplateNames(), \true)) { + return null; + } return $entityGenericType->name; } private function containsMethodCallNamed(ClassMethod $classMethod, string $desiredMethodName) : bool diff --git a/src/Application/VersionResolver.php b/src/Application/VersionResolver.php index 6e3d508bc75..04f7b4a9aca 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 = '26890958bc539e9a2234f1457a81d37f5972bf79'; + public const PACKAGE_VERSION = 'f4070bb2b2f5c8f7a11063ce35549364c437a9cf'; /** * @api * @var string */ - public const RELEASE_DATE = '2024-03-20 14:19:00'; + public const RELEASE_DATE = '2024-03-21 10:52:56'; /** * @var int */ diff --git a/src/BetterPhpDocParser/PhpDocInfo/PhpDocInfo.php b/src/BetterPhpDocParser/PhpDocInfo/PhpDocInfo.php index 228860bfb99..1b2322b85f0 100644 --- a/src/BetterPhpDocParser/PhpDocInfo/PhpDocInfo.php +++ b/src/BetterPhpDocParser/PhpDocInfo/PhpDocInfo.php @@ -329,6 +329,17 @@ final class PhpDocInfo } return null; } + /** + * @return string[] + */ + public function getTemplateNames() : array + { + $templateNames = []; + foreach ($this->phpDocNode->getTemplateTagValues() as $templateTagValueNode) { + $templateNames[] = $templateTagValueNode->name; + } + return $templateNames; + } /** * @return TemplateTagValueNode[] */