More cleanup of tag creation

TagWithType need to be created via a factory now.
This commit is contained in:
Jaapio
2025-12-24 16:16:59 +01:00
parent 02f9ed7a8f
commit fba45a3718
20 changed files with 267 additions and 377 deletions
+21 -12
View File
@@ -26,6 +26,7 @@ use phpDocumentor\Reflection\DocBlock\Tags\Return_;
use phpDocumentor\Reflection\DocBlock\Tags\See;
use phpDocumentor\Reflection\DocBlock\Tags\Since;
use phpDocumentor\Reflection\DocBlock\Tags\Template;
use phpDocumentor\Reflection\Exception\ParserException;
use phpDocumentor\Reflection\PseudoTypes\ConstExpression;
use phpDocumentor\Reflection\Types\Array_;
use phpDocumentor\Reflection\Types\Compound;
@@ -242,18 +243,26 @@ DOC;
$factory = DocBlockFactory::createInstance();
$docblock = $factory->create($docComment);
self::assertEquals(
[
InvalidTag::create(
'array\Foo> $test',
'param',
)->withError(
new \InvalidArgumentException(
'Could not find type in array\Foo> $test, please check for malformed notations')
),
],
$docblock->getTags()
);
$tags = $docblock->getTags();
self::assertCount(1, $docblock->getTags());
self::assertInstanceOf(InvalidTag::class, $tags[0]);
self::assertCount(1, $docblock->getTags());
self::assertSame('Failed to parse docblock: Unexpected token ">", expected variable at offset 16 on line 1', $tags[0]->getException()->getMessage());
// self::assertEquals(
// [
// InvalidTag::create(
// 'array\Foo> $test',
// 'param',
// )->withError(
// new ParserException(
// 'Could not find type in array\Foo> $test, please check for malformed notations', 'aa', 1)
// ),
// ],
// $docblock->getTags()
// );
}
public function testConstantReferenceTypes(): void