Add test for constant references.

This commit is contained in:
Jaapio
2024-04-08 22:15:57 +02:00
parent 67a55cc31d
commit 08acd34f7e
@@ -21,9 +21,13 @@ use phpDocumentor\Reflection\DocBlock\Tags\InvalidTag;
use phpDocumentor\Reflection\DocBlock\Tags\Method; use phpDocumentor\Reflection\DocBlock\Tags\Method;
use phpDocumentor\Reflection\DocBlock\Tags\MethodParameter; use phpDocumentor\Reflection\DocBlock\Tags\MethodParameter;
use phpDocumentor\Reflection\DocBlock\Tags\Param; use phpDocumentor\Reflection\DocBlock\Tags\Param;
use phpDocumentor\Reflection\DocBlock\Tags\Return_;
use phpDocumentor\Reflection\DocBlock\Tags\See; use phpDocumentor\Reflection\DocBlock\Tags\See;
use phpDocumentor\Reflection\PseudoTypes\ConstExpression;
use phpDocumentor\Reflection\Types\Array_; use phpDocumentor\Reflection\Types\Array_;
use phpDocumentor\Reflection\Types\Integer; use phpDocumentor\Reflection\Types\Integer;
use phpDocumentor\Reflection\Types\Mixed_;
use phpDocumentor\Reflection\Types\Self_;
use phpDocumentor\Reflection\Types\String_; use phpDocumentor\Reflection\Types\String_;
use phpDocumentor\Reflection\Types\Void_; use phpDocumentor\Reflection\Types\Void_;
use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestCase;
@@ -245,4 +249,23 @@ DOC;
$docblock->getTags() $docblock->getTags()
); );
} }
public function testConstantReferenceTypes(): void
{
$docCommment = <<<DOC
/**
* @return self::STATUS_*
*/
DOC;
$factory = DocBlockFactory::createInstance();
$docblock = $factory->create($docCommment);
self::assertEquals(
[
new Return_(new ConstExpression(new Self_(), 'STATUS_*'), new Description('')),
],
$docblock->getTags()
);
}
} }