rector icon indicating copy to clipboard operation
rector copied to clipboard

Attribute "Doctrine\ORM\Mapping\Entity" must not be repeated

Open FrancoFasano opened this issue 1 year ago • 1 comments

Hi, I run the rector.php to migrate annotations to attributes on a symfony 5.4 project and this issue occured in AttributeReader.php line 115 : Attribute "Doctrine\ORM\Mapping\Entity" must not be repeated

I don't know how to fix it. Do you know what is the origin of this error?

This is the rector.php file created for migration :

`<?php

declare(strict_types=1);

use Rector\Config\RectorConfig; use Rector\CodeQuality\Rector\Class_\InlineConstructorDefaultToPropertyRector; use Rector\Php80\Rector\Class_\AnnotationToAttributeRector; use Rector\Php80\ValueObject\AnnotationToAttribute;

use Rector\Doctrine\Set\DoctrineSetList; use Rector\Symfony\Set\SymfonySetList;

return function (RectorConfig $rectorConfig): void { $rectorConfig->paths([ // DIR . '/src/Entity', DIR . '/config', DIR . '/public', DIR . '/src', DIR . '/tests', ]); $rectorConfig->sets([ \Rector\Doctrine\Set\DoctrineSetList::ANNOTATIONS_TO_ATTRIBUTES, \Rector\Symfony\Set\SymfonySetList::ANNOTATIONS_TO_ATTRIBUTES, \Rector\Symfony\Set\SensiolabsSetList::ANNOTATIONS_TO_ATTRIBUTES, ]); $rectorConfig->ruleWithConfiguration(AnnotationToAttributeRector::class, [ new AnnotationToAttribute(\Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity::class), new AnnotationToAttribute(\Ibericode\Vat\Bundle\Validator\Constraints\VatNumber::class), ]); }; `

FrancoFasano avatar Apr 02 '24 10:04 FrancoFasano

Thank you for your report!

We'll need an isolated failing demo link from: http://getrector.com/demo, that way we can reproduce the bug.

TomasVotruba avatar Apr 02 '24 10:04 TomasVotruba

Closing for lack of feedback. Thanks for understanding :+1:

TomasVotruba avatar May 20 '24 02:05 TomasVotruba