|
25 | 25 | use phpDocumentor\Reflection\DocBlock\Tags\Formatter; |
26 | 26 | use phpDocumentor\Reflection\DocBlock\Tags\Formatter\PassthroughFormatter; |
27 | 27 | use phpDocumentor\Reflection\DocBlock\Tags\Generic; |
| 28 | +use phpDocumentor\Reflection\DocBlock\Tags\Method; |
| 29 | +use phpDocumentor\Reflection\DocBlock\Tags\Mixin; |
| 30 | +use phpDocumentor\Reflection\DocBlock\Tags\Param; |
| 31 | +use phpDocumentor\Reflection\DocBlock\Tags\Property; |
| 32 | +use phpDocumentor\Reflection\DocBlock\Tags\PropertyRead; |
| 33 | +use phpDocumentor\Reflection\DocBlock\Tags\PropertyWrite; |
| 34 | +use phpDocumentor\Reflection\DocBlock\Tags\Return_; |
28 | 35 | use phpDocumentor\Reflection\DocBlock\Tags\See; |
| 36 | +use phpDocumentor\Reflection\DocBlock\Tags\TagWithType; |
| 37 | +use phpDocumentor\Reflection\DocBlock\Tags\TemplateCovariant; |
| 38 | +use phpDocumentor\Reflection\DocBlock\Tags\Throws; |
| 39 | +use phpDocumentor\Reflection\DocBlock\Tags\Var_; |
29 | 40 | use phpDocumentor\Reflection\Fqsen; |
30 | 41 | use phpDocumentor\Reflection\FqsenResolver; |
31 | 42 | use phpDocumentor\Reflection\TypeResolver; |
@@ -544,4 +555,36 @@ public function invalidTagProvider(): array |
544 | 555 | ['@tag@invalid'], |
545 | 556 | ]; |
546 | 557 | } |
| 558 | + |
| 559 | + /** |
| 560 | + * @dataProvider provideCreateWithTagWithTypesData |
| 561 | + * |
| 562 | + * @param class-string $expectedClass |
| 563 | + */ |
| 564 | + public function testCreateWithTagWithTypes(string $input, string $expectedClass): void |
| 565 | + { |
| 566 | + $tagFactory = StandardTagFactory::createInstance(new FqsenResolver()); |
| 567 | + $tag = $tagFactory->create($input); |
| 568 | + |
| 569 | + $this->assertInstanceOf($expectedClass, $tag); |
| 570 | + } |
| 571 | + |
| 572 | + /** |
| 573 | + * @return list<array{string, class-string}> |
| 574 | + */ |
| 575 | + public static function provideCreateWithTagWithTypesData(): array |
| 576 | + { |
| 577 | + return [ |
| 578 | + ['@mixin Foo', Mixin::class], |
| 579 | + ['@method string do()', Method::class], |
| 580 | + ['@param Foo $bar', Param::class], |
| 581 | + ['@property-read Foo $bar', PropertyRead::class], |
| 582 | + ['@property Foo $bar', Property::class], |
| 583 | + ['@property-write Foo $bar', PropertyWrite::class], |
| 584 | + ['@return string', Return_::class], |
| 585 | + ['@throws Throwable', Throws::class], |
| 586 | + ['@var string $var', Var_::class], |
| 587 | + ['@template-covariant string', TemplateCovariant::class], |
| 588 | + ]; |
| 589 | + } |
547 | 590 | } |
0 commit comments