Skip to content

Commit

Permalink
Add test for constant references.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaapio committed Apr 8, 2024
1 parent 67a55cc commit 08acd34
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions tests/integration/InterpretingDocBlocksTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,13 @@
use phpDocumentor\Reflection\DocBlock\Tags\Method;
use phpDocumentor\Reflection\DocBlock\Tags\MethodParameter;
use phpDocumentor\Reflection\DocBlock\Tags\Param;
use phpDocumentor\Reflection\DocBlock\Tags\Return_;
use phpDocumentor\Reflection\DocBlock\Tags\See;
use phpDocumentor\Reflection\PseudoTypes\ConstExpression;
use phpDocumentor\Reflection\Types\Array_;
use phpDocumentor\Reflection\Types\Integer;
use phpDocumentor\Reflection\Types\Mixed_;
use phpDocumentor\Reflection\Types\Self_;
use phpDocumentor\Reflection\Types\String_;
use phpDocumentor\Reflection\Types\Void_;
use PHPUnit\Framework\TestCase;
Expand Down Expand Up @@ -245,4 +249,23 @@ public function testInvalidTypeParamResultsInInvalidTag(): void
$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()
);
}
}

0 comments on commit 08acd34

Please sign in to comment.