File tree Expand file tree Collapse file tree 3 files changed +17
-0
lines changed Expand file tree Collapse file tree 3 files changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -208,6 +208,10 @@ public function enterNode(Node $node)
208208 }
209209 };
210210
211+ if ($ this ->statements ) {
212+ $ this ->addCommentAndAttributes ($ phpFile , $ this ->statements [0 ]);
213+ }
214+
211215 $ traverser = new PhpParser \NodeTraverser ;
212216 $ traverser ->addVisitor ($ visitor );
213217 $ traverser ->traverse ($ this ->statements );
@@ -367,6 +371,7 @@ private function addCommentAndAttributes($element, Node $node): void
367371 $ comment = $ node ->getDocComment ()->getReformattedText ();
368372 $ comment = Helpers::unformatDocComment ($ comment );
369373 $ element ->setComment ($ comment );
374+ $ node ->setDocComment (new PhpParser \Comment \Doc ('' ));
370375 }
371376
372377 foreach ($ node ->attrGroups ?? [] as $ group ) {
Original file line number Diff line number Diff line change 11<?php
22
3+ /**
4+ * First comment
5+ */
6+
37declare(strict_types=1);
48
59namespace Abc;
Original file line number Diff line number Diff line change 11<?php
22
3+ /**
4+ * First comment
5+ */
6+
37declare (strict_types=1 );
48
9+ /**
10+ * Second comment
11+ */
12+
513namespace Abc ;
614
715/**
You can’t perform that action at this time.
0 commit comments