Skip to content

Commit

Permalink
[Php80] Do not remove existing attribute on NestedAnnotationToAttribu…
Browse files Browse the repository at this point in the history
…teRector (#3116)

* [Php80] Do not remove existing attribute on NestedAnnotationToAttributeRector

* Fixed 🎉
  • Loading branch information
samsonasik committed Nov 28, 2022
1 parent c72e697 commit 93e87a1
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?php

declare(strict_types=1);

namespace Rector\Tests\Php80\Rector\Property\NestedAnnotationToAttributeRector\Fixture;

use Doctrine\ORM\Mapping as ORM;

/**
* @ORM\Table(name="api_alert")
*/
#[ApiResource]
class Alert
{
}

?>
-----
<?php

declare(strict_types=1);

namespace Rector\Tests\Php80\Rector\Property\NestedAnnotationToAttributeRector\Fixture;

use Doctrine\ORM\Mapping as ORM;

#[ApiResource]
#[ORM\Table(name: 'api_alert')]
class Alert
{
}

?>
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ public function refactor(Node $node): ?Node
return null;
}

$node->attrGroups = $attributeGroups;
$node->attrGroups = array_merge($node->attrGroups, $attributeGroups);
$this->completeExtraUseImports($attributeGroups);

return $node;
Expand Down

0 comments on commit 93e87a1

Please sign in to comment.