@@ -108,6 +108,7 @@ protected function setUp(): void
108108 * @dataProvider provideMixinTagsData
109109 * @dataProvider provideRequireExtendsTagsData
110110 * @dataProvider provideRequireImplementsTagsData
111+ * @dataProvider provideInheritorsTagsData
111112 * @dataProvider provideDeprecatedTagsData
112113 * @dataProvider providePropertyTagsData
113114 * @dataProvider provideMethodTagsData
@@ -2210,6 +2211,72 @@ public function provideRequireImplementsTagsData(): Iterator
22102211 ];
22112212 }
22122213
2214+ public function provideInheritorsTagsData (): Iterator
2215+ {
2216+ yield [
2217+ 'OK without description ' ,
2218+ '/** @phpstan-inheritors Foo|Bar */ ' ,
2219+ new PhpDocNode ([
2220+ new PhpDocTagNode (
2221+ '@phpstan-inheritors ' ,
2222+ new RequireImplementsTagValueNode (
2223+ new IdentifierTypeNode ('Foo|Bar ' ),
2224+ '' ,
2225+ ),
2226+ ),
2227+ ]),
2228+ ];
2229+
2230+ yield [
2231+ 'OK with description ' ,
2232+ '/** @phpstan-inheritors Foo|Bar optional description */ ' ,
2233+ new PhpDocNode ([
2234+ new PhpDocTagNode (
2235+ '@phpstan-inheritors ' ,
2236+ new RequireImplementsTagValueNode (
2237+ new IdentifierTypeNode ('Foo|Bar ' ),
2238+ 'optional description ' ,
2239+ ),
2240+ ),
2241+ ]),
2242+ ];
2243+
2244+ yield [
2245+ 'OK with psalm-prefix description ' ,
2246+ '/** @psalm-inheritors Foo|Bar optional description */ ' ,
2247+ new PhpDocNode ([
2248+ new PhpDocTagNode (
2249+ '@psalm-inheritors ' ,
2250+ new RequireImplementsTagValueNode (
2251+ new IdentifierTypeNode ('Foo|Bar ' ),
2252+ 'optional description ' ,
2253+ ),
2254+ ),
2255+ ]),
2256+ ];
2257+
2258+ yield [
2259+ 'invalid without type and description ' ,
2260+ '/** @phpstan-inheritors */ ' ,
2261+ new PhpDocNode ([
2262+ new PhpDocTagNode (
2263+ '@phpstan-inheritors ' ,
2264+ new InvalidTagValueNode (
2265+ '' ,
2266+ new ParserException (
2267+ '*/ ' ,
2268+ Lexer::TOKEN_CLOSE_PHPDOC ,
2269+ 32 ,
2270+ Lexer::TOKEN_IDENTIFIER ,
2271+ null ,
2272+ 1 ,
2273+ ),
2274+ ),
2275+ ),
2276+ ]),
2277+ ];
2278+ }
2279+
22132280 public function provideDeprecatedTagsData (): Iterator
22142281 {
22152282 yield [
0 commit comments