|
20 | 20 | use PHPStan\PhpDocParser\Ast\Type\IntersectionTypeNode;
|
21 | 21 | use PHPStan\PhpDocParser\Ast\Type\NullableTypeNode;
|
22 | 22 | use PHPStan\PhpDocParser\Ast\Type\OffsetAccessTypeNode;
|
| 23 | +use PHPStan\PhpDocParser\Ast\Type\StarProjectionNode; |
23 | 24 | use PHPStan\PhpDocParser\Ast\Type\ThisTypeNode;
|
24 | 25 | use PHPStan\PhpDocParser\Ast\Type\TypeNode;
|
| 26 | +use PHPStan\PhpDocParser\Ast\Type\TypeProjectionNode; |
25 | 27 | use PHPStan\PhpDocParser\Ast\Type\UnionTypeNode;
|
26 | 28 | use PHPStan\PhpDocParser\Lexer\Lexer;
|
27 | 29 | use PHPUnit\Framework\TestCase;
|
@@ -1266,6 +1268,51 @@ public function provideParseData(): array
|
1266 | 1268 | )
|
1267 | 1269 | ),
|
1268 | 1270 | ],
|
| 1271 | + [ |
| 1272 | + 'Foo<covariant Bar, Baz>', |
| 1273 | + new GenericTypeNode( |
| 1274 | + new IdentifierTypeNode('Foo'), |
| 1275 | + [ |
| 1276 | + new TypeProjectionNode( |
| 1277 | + new IdentifierTypeNode('Bar'), |
| 1278 | + 'covariant' |
| 1279 | + ), |
| 1280 | + new IdentifierTypeNode('Baz'), |
| 1281 | + ] |
| 1282 | + ), |
| 1283 | + ], |
| 1284 | + [ |
| 1285 | + 'Foo<Bar, contravariant Baz>', |
| 1286 | + new GenericTypeNode( |
| 1287 | + new IdentifierTypeNode('Foo'), |
| 1288 | + [ |
| 1289 | + new IdentifierTypeNode('Bar'), |
| 1290 | + new TypeProjectionNode( |
| 1291 | + new IdentifierTypeNode('Baz'), |
| 1292 | + 'contravariant' |
| 1293 | + ), |
| 1294 | + ] |
| 1295 | + ), |
| 1296 | + ], |
| 1297 | + [ |
| 1298 | + 'Foo<covariant>', |
| 1299 | + new ParserException( |
| 1300 | + '>', |
| 1301 | + Lexer::TOKEN_CLOSE_ANGLE_BRACKET, |
| 1302 | + 13, |
| 1303 | + Lexer::TOKEN_IDENTIFIER |
| 1304 | + ), |
| 1305 | + ], |
| 1306 | + [ |
| 1307 | + 'Foo<Bar, *>', |
| 1308 | + new GenericTypeNode( |
| 1309 | + new IdentifierTypeNode('Foo'), |
| 1310 | + [ |
| 1311 | + new IdentifierTypeNode('Bar'), |
| 1312 | + new StarProjectionNode(), |
| 1313 | + ] |
| 1314 | + ), |
| 1315 | + ], |
1269 | 1316 | ];
|
1270 | 1317 | }
|
1271 | 1318 |
|
|
0 commit comments