Skip to content

Commit cf34490

Browse files
committed
Append namespace imports instead of prepend in NamespaceUse visitor - Close #21
1 parent 9cea4c4 commit cf34490

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

src/NodeVisitor/NamespaceUse.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,18 +47,15 @@ public function afterTraverse(array $nodes): ?array
4747
$newNodes[] = $node;
4848

4949
if ($node instanceof Stmt\Namespace_) {
50-
$stmts = $node->stmts;
5150
foreach ($imports as $import) {
5251
if (\is_array($import)) {
5352
$useNamespace = $this->builderFactory->use($import[0]);
5453
$useNamespace->as($import[1]);
5554
} else {
5655
$useNamespace = $this->builderFactory->use($import);
5756
}
58-
59-
\array_unshift($stmts, $useNamespace->getNode());
57+
$node->stmts[] = $useNamespace->getNode(); // @phpstan-ignore-line
6058
}
61-
$node->stmts = $stmts; // @phpstan-ignore-line
6259
}
6360
}
6461

0 commit comments

Comments
 (0)