@@ -11,6 +11,7 @@ import {
1111 ParamClosureThisTagValueNode ,
1212 ParamImmediatelyInvokedCallableTagValueNode ,
1313 ParamLaterInvokedCallableTagValueNode ,
14+ PhpDocNode ,
1415 PhpDocParser ,
1516 PureUnlessCallableIsImpureTagValueNode ,
1617 RequireExtendsTagValueNode ,
@@ -112,6 +113,41 @@ describe('Upstream 2024 Features', () => {
112113 } ) ;
113114 } ) ;
114115
116+ describe ( 'PhpDocNode.getSealedTagValues()' , ( ) => {
117+ it ( 'should return sealed tag values' , ( ) => {
118+ const lexer = new Lexer ( ) ;
119+ const constExprParser = new ConstExprParser ( ) ;
120+ const typeParser = new TypeParser ( constExprParser ) ;
121+ const phpDocParser = new PhpDocParser ( typeParser , constExprParser ) ;
122+
123+ const tokens = new TokenIterator (
124+ lexer . tokenize ( '/** @phpstan-sealed ChildA|ChildB */' ) ,
125+ ) ;
126+
127+ const phpDoc = phpDocParser . parse ( tokens ) ;
128+ const sealedValues = phpDoc . getSealedTagValues ( ) ;
129+ expect ( sealedValues ) . toHaveLength ( 1 ) ;
130+ expect ( sealedValues [ 0 ] ) . toBeInstanceOf ( SealedTagValueNode ) ;
131+ expect ( sealedValues [ 0 ] . type ) . toBeInstanceOf ( UnionTypeNode ) ;
132+ } ) ;
133+
134+ it ( 'should return sealed tag values for @psalm-inheritors' , ( ) => {
135+ const lexer = new Lexer ( ) ;
136+ const constExprParser = new ConstExprParser ( ) ;
137+ const typeParser = new TypeParser ( constExprParser ) ;
138+ const phpDocParser = new PhpDocParser ( typeParser , constExprParser ) ;
139+
140+ const tokens = new TokenIterator (
141+ lexer . tokenize ( '/** @psalm-inheritors ChildA|ChildB */' ) ,
142+ ) ;
143+
144+ const phpDoc = phpDocParser . parse ( tokens ) ;
145+ const sealedValues = phpDoc . getSealedTagValues ( '@psalm-inheritors' ) ;
146+ expect ( sealedValues ) . toHaveLength ( 1 ) ;
147+ expect ( sealedValues [ 0 ] ) . toBeInstanceOf ( SealedTagValueNode ) ;
148+ } ) ;
149+ } ) ;
150+
115151 describe ( '@psalm-inheritors tag' , ( ) => {
116152 it ( 'should parse @psalm-inheritors tag with type' , ( ) => {
117153 const lexer = new Lexer ( ) ;
0 commit comments