|
21 | 21 | use phpDocumentor\Reflection\Assets\CustomServiceInterface; |
22 | 22 | use phpDocumentor\Reflection\Assets\CustomTagFactory; |
23 | 23 | use phpDocumentor\Reflection\DocBlock\Tags\Author; |
24 | | -use phpDocumentor\Reflection\DocBlock\Tags\InvalidTag; |
25 | 24 | use phpDocumentor\Reflection\DocBlock\Tags\Deprecated; |
26 | 25 | use phpDocumentor\Reflection\DocBlock\Tags\Extends_; |
27 | 26 | use phpDocumentor\Reflection\DocBlock\Tags\Formatter; |
28 | 27 | use phpDocumentor\Reflection\DocBlock\Tags\Formatter\PassthroughFormatter; |
29 | 28 | use phpDocumentor\Reflection\DocBlock\Tags\Generic; |
30 | 29 | use phpDocumentor\Reflection\DocBlock\Tags\Implements_; |
| 30 | +use phpDocumentor\Reflection\DocBlock\Tags\InvalidTag; |
31 | 31 | use phpDocumentor\Reflection\DocBlock\Tags\Method; |
32 | 32 | use phpDocumentor\Reflection\DocBlock\Tags\Mixin; |
33 | 33 | use phpDocumentor\Reflection\DocBlock\Tags\Param; |
@@ -158,6 +158,30 @@ public function testInvalidTagReceivesFormatHintFromHandler(): void |
158 | 158 | $this->assertSame(Author::getDocumentationUrl(), $tag->getDocumentationUrl()); |
159 | 159 | } |
160 | 160 |
|
| 161 | + /** |
| 162 | + * @uses \phpDocumentor\Reflection\DocBlock\StandardTagFactory::addService |
| 163 | + * @uses \phpDocumentor\Reflection\DocBlock\Tags\Generic |
| 164 | + * @uses \phpDocumentor\Reflection\DocBlock\Tags\BaseTag |
| 165 | + * @uses \phpDocumentor\Reflection\DocBlock\Tags\InvalidTag |
| 166 | + * |
| 167 | + * @covers ::__construct |
| 168 | + * @covers ::create |
| 169 | + */ |
| 170 | + public function testInvalidTagKeepsNullHintsWhenHandlerDoesNotAdvertiseAny(): void |
| 171 | + { |
| 172 | + $context = new Context(''); |
| 173 | + $descriptionFactory = m::mock(DescriptionFactory::class); |
| 174 | + $descriptionFactory->shouldReceive('create')->andThrow(new InvalidArgumentException('boom')); |
| 175 | + $tagFactory = StandardTagFactory::createInstance(m::mock(FqsenResolver::class)); |
| 176 | + $tagFactory->addService($descriptionFactory, DescriptionFactory::class); |
| 177 | + |
| 178 | + $tag = $tagFactory->create('@custom anything', $context); |
| 179 | + |
| 180 | + $this->assertInstanceOf(InvalidTag::class, $tag); |
| 181 | + $this->assertNull($tag->getExpectedFormat()); |
| 182 | + $this->assertNull($tag->getDocumentationUrl()); |
| 183 | + } |
| 184 | + |
161 | 185 | /** |
162 | 186 | * @uses \phpDocumentor\Reflection\DocBlock\StandardTagFactory::addService |
163 | 187 | * @uses \phpDocumentor\Reflection\DocBlock\Tags\See |
|
0 commit comments