Skip to content

Commit

Permalink
[AutoImport] Ensure change to FullyQualified for Attribute on just ch…
Browse files Browse the repository at this point in the history
…anged from annotation (#5216)
  • Loading branch information
samsonasik committed Oct 31, 2023
1 parent 06f806c commit 95d0331
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/PostRector/Rector/NameImportingPostRector.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,13 +95,13 @@ private function resolveNameFromAttribute(Name $name): Name
return $name;
}

if ($name->hasAttribute(AttributeKey::PHP_ATTRIBUTE_NAME)) {
if (array_keys($name->getAttributes()) === [AttributeKey::PHP_ATTRIBUTE_NAME]) {
$oldToNewClasses = $this->renamedClassesDataCollector->getOldToNewClasses();
$phpAttributeName = $name->getAttribute(AttributeKey::PHP_ATTRIBUTE_NAME);

foreach ($oldToNewClasses as $oldName => $newName) {
if ($oldName === $phpAttributeName) {
return new FullyQualified($newName);
return new FullyQualified($newName, $name->getAttributes());
}
}
}
Expand Down

0 comments on commit 95d0331

Please sign in to comment.