Skip to content

Commit

Permalink
Fix comment position in use doc tags
Browse files Browse the repository at this point in the history
  • Loading branch information
carlos-granados committed Sep 12, 2024
1 parent e8ee463 commit 919f57c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/AttributeNodeVisitor.php
Original file line number Diff line number Diff line change
Expand Up @@ -684,10 +684,10 @@ private function addDocTagsToNode(array $tagsToAdd, Node $node): void
#[Param(useTagsToAdd: 'string[]')]
private function addUseDocTagsToNodeTraitUses(array $useTagsToAdd, Stmt\Class_ $node): void
{
$this->initPositions();
foreach ($node->stmts as $stmt) {
if ($stmt instanceof Stmt\TraitUse) {
foreach ($stmt->traits as $trait) {
$this->initPositions();
foreach ($useTagsToAdd as $tagValue => $useTag) {
$tagParts = explode('<', (string)$tagValue);
$tagName = $tagParts[0];
Expand All @@ -701,6 +701,7 @@ private function addUseDocTagsToNodeTraitUses(array $useTagsToAdd, Stmt\Class_ $
}
}
if ($useMatches) {
$this->updatePositions($stmt);
$this->addDocTagsToNode([$useTag], $stmt);
unset($useTagsToAdd[$tagName]);
break;
Expand Down

0 comments on commit 919f57c

Please sign in to comment.