@@ -664,17 +664,33 @@ public function enterNode(Node $node)
664
664
665
665
};
666
666
667
- $ addItemsToMultilineArrayShape = new class extends AbstractNodeVisitor {
667
+ $ addSingleLineCommentsToMultilineArrayShape = new class extends AbstractNodeVisitor {
668
668
669
669
public function enterNode (Node $ node )
670
670
{
671
671
if ($ node instanceof ArrayShapeNode) {
672
- $ commentedNode = new ArrayShapeItemNode (new IdentifierTypeNode ('c ' ), false , new IdentifierTypeNode ('int ' ));
672
+ $ commentedNode = new ArrayShapeItemNode (new IdentifierTypeNode ('b ' ), false , new IdentifierTypeNode ('int ' ));
673
673
$ commentedNode ->setAttribute (Attribute::COMMENTS , [new Comment ('// bar ' )]);
674
674
array_splice ($ node ->items , 1 , 0 , [
675
675
$ commentedNode ,
676
676
]);
677
- $ node ->items [] = new ArrayShapeItemNode (new IdentifierTypeNode ('d ' ), false , new IdentifierTypeNode ('string ' ));
677
+ $ commentedNode = new ArrayShapeItemNode (new IdentifierTypeNode ('d ' ), false , new IdentifierTypeNode ('string ' ));
678
+ $ commentedNode ->setAttribute (Attribute::COMMENTS , [new Comment (
679
+ '/* This is a
680
+ multiline
681
+ comment
682
+ */ '
683
+ )]);
684
+ $ node ->items [] = $ commentedNode ;
685
+
686
+ $ commentedNode = new ArrayShapeItemNode (new IdentifierTypeNode ('e ' ), false , new IdentifierTypeNode ('string ' ));
687
+ $ commentedNode ->setAttribute (Attribute::COMMENTS , [new Comment (
688
+ '/* Another
689
+ * multiline
690
+ * comment with leading asterisks
691
+ */ '
692
+ )]);
693
+ $ node ->items [] = $ commentedNode ;
678
694
}
679
695
680
696
return $ node ;
@@ -687,22 +703,32 @@ public function enterNode(Node $node)
687
703
* @return array{
688
704
* // foo
689
705
* a: int,
690
- * b : string
706
+ * c : string
691
707
* }
692
708
*/ ' ,
693
709
'/**
694
710
* @return array{
695
711
* // foo
696
712
* a: int,
697
713
* // bar
698
- * c: int,
699
- * b: string,
700
- * d: string
714
+ * b: int,
715
+ * c: string,
716
+ * /* This is a
717
+ * multiline
718
+ * comment
719
+ * */
720
+ * d: string,
721
+ * /* Another
722
+ * * multiline
723
+ * * comment with leading asterisks
724
+ * */
725
+ * e: string
701
726
* }
702
727
*/ ' ,
703
- $ addItemsToMultilineArrayShape ,
728
+ $ addSingleLineCommentsToMultilineArrayShape ,
704
729
];
705
730
731
+
706
732
yield [
707
733
'/**
708
734
* @return array{float}
0 commit comments