File tree Expand file tree Collapse file tree 2 files changed +24
-2
lines changed Expand file tree Collapse file tree 2 files changed +24
-2
lines changed Original file line number Diff line number Diff line change @@ -141,7 +141,6 @@ final class Printer
141
141
CallableTypeNode::class,
142
142
UnionTypeNode::class,
143
143
IntersectionTypeNode::class,
144
- ConstTypeNode::class,
145
144
NullableTypeNode::class,
146
145
],
147
146
];
@@ -512,7 +511,6 @@ private function printOffsetAccessType(TypeNode $type): string
512
511
$ type instanceof CallableTypeNode
513
512
|| $ type instanceof UnionTypeNode
514
513
|| $ type instanceof IntersectionTypeNode
515
- || $ type instanceof ConstTypeNode
516
514
|| $ type instanceof NullableTypeNode
517
515
) {
518
516
return $ this ->wrapInParentheses ($ type );
Original file line number Diff line number Diff line change @@ -1723,6 +1723,23 @@ public function enterNode(Node $node)
1723
1723
1724
1724
},
1725
1725
];
1726
+
1727
+ yield [
1728
+ '/** @return Foo[abc] */ ' ,
1729
+ '/** @return self::FOO[abc] */ ' ,
1730
+ new class extends AbstractNodeVisitor {
1731
+
1732
+ public function enterNode (Node $ node )
1733
+ {
1734
+ if ($ node instanceof ReturnTagValueNode && $ node ->type instanceof OffsetAccessTypeNode) {
1735
+ $ node ->type ->type = new ConstTypeNode (new ConstFetchNode ('self ' , 'FOO ' ));
1736
+ }
1737
+
1738
+ return $ node ;
1739
+ }
1740
+
1741
+ },
1742
+ ];
1726
1743
}
1727
1744
1728
1745
/**
@@ -1862,6 +1879,13 @@ public function dataPrintType(): iterable
1862
1879
]),
1863
1880
'Foo|Bar|(Baz|Lorem) ' ,
1864
1881
];
1882
+ yield [
1883
+ new OffsetAccessTypeNode (
1884
+ new ConstTypeNode (new ConstFetchNode ('self ' , 'TYPES ' )),
1885
+ new IdentifierTypeNode ('int ' )
1886
+ ),
1887
+ 'self::TYPES[int] ' ,
1888
+ ];
1865
1889
}
1866
1890
1867
1891
/**
You can’t perform that action at this time.
0 commit comments