Skip to content

Commit 919f57c

Browse files
Fix comment position in use doc tags
1 parent e8ee463 commit 919f57c

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/AttributeNodeVisitor.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -684,10 +684,10 @@ private function addDocTagsToNode(array $tagsToAdd, Node $node): void
684684
#[Param(useTagsToAdd: 'string[]')]
685685
private function addUseDocTagsToNodeTraitUses(array $useTagsToAdd, Stmt\Class_ $node): void
686686
{
687-
$this->initPositions();
688687
foreach ($node->stmts as $stmt) {
689688
if ($stmt instanceof Stmt\TraitUse) {
690689
foreach ($stmt->traits as $trait) {
690+
$this->initPositions();
691691
foreach ($useTagsToAdd as $tagValue => $useTag) {
692692
$tagParts = explode('<', (string)$tagValue);
693693
$tagName = $tagParts[0];
@@ -701,6 +701,7 @@ private function addUseDocTagsToNodeTraitUses(array $useTagsToAdd, Stmt\Class_ $
701701
}
702702
}
703703
if ($useMatches) {
704+
$this->updatePositions($stmt);
704705
$this->addDocTagsToNode([$useTag], $stmt);
705706
unset($useTagsToAdd[$tagName]);
706707
break;

0 commit comments

Comments
 (0)