diff --git a/src/PhpAttribute/GenericAnnotationToAttributeConverter.php b/src/PhpAttribute/GenericAnnotationToAttributeConverter.php deleted file mode 100644 index 4c97f919bfb..00000000000 --- a/src/PhpAttribute/GenericAnnotationToAttributeConverter.php +++ /dev/null @@ -1,108 +0,0 @@ -isExistingAttributeClass($annotationToAttribute)) { - return null; - } - - $phpDocInfo = $this->phpDocInfoFactory->createFromNode($node); - if (! $phpDocInfo instanceof PhpDocInfo) { - return null; - } - - $uses = $this->useImportsResolver->resolveBareUses(); - - return $this->processDoctrineAnnotationClass($phpDocInfo, $uses, $annotationToAttribute); - } - - /** - * @param Use_[] $uses - */ - private function processDoctrineAnnotationClass( - PhpDocInfo $phpDocInfo, - array $uses, - AnnotationToAttribute $annotationToAttribute - ): ?AttributeGroup { - if ($phpDocInfo->getPhpDocNode()->children === []) { - return null; - } - - $doctrineTagAndAnnotationToAttributes = []; - $doctrineTagValueNodes = []; - - foreach ($phpDocInfo->getPhpDocNode()->children as $phpDocChildNode) { - if (! $phpDocChildNode instanceof PhpDocTagNode) { - continue; - } - - if (! $phpDocChildNode->value instanceof DoctrineAnnotationTagValueNode) { - continue; - } - - $doctrineTagValueNode = $phpDocChildNode->value; - if (! $doctrineTagValueNode->hasClassName($annotationToAttribute->getTag())) { - continue; - } - - $doctrineTagAndAnnotationToAttributes[] = new DoctrineTagAndAnnotationToAttribute( - $doctrineTagValueNode, - $annotationToAttribute - ); - - $doctrineTagValueNodes[] = $doctrineTagValueNode; - } - - $attributeGroups = $this->attrGroupsFactory->create($doctrineTagAndAnnotationToAttributes, $uses); - - foreach ($doctrineTagValueNodes as $doctrineTagValueNode) { - $this->phpDocTagRemover->removeTagValueFromNode($phpDocInfo, $doctrineTagValueNode); - } - - return $attributeGroups[0] ?? null; - } - - private function isExistingAttributeClass(AnnotationToAttribute $annotationToAttribute): bool - { - // make sure the attribute class really exists to avoid error on early upgrade - if (! $this->reflectionProvider->hasClass($annotationToAttribute->getAttributeClass())) { - return false; - } - - // make sure the class is marked as attribute - $classReflection = $this->reflectionProvider->getClass($annotationToAttribute->getAttributeClass()); - return $classReflection->isAttributeClass(); - } -}