Skip to content

Commit 08acd34

Browse files
committed
Add test for constant references.
1 parent 67a55cc commit 08acd34

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

tests/integration/InterpretingDocBlocksTest.php

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,13 @@
2121
use phpDocumentor\Reflection\DocBlock\Tags\Method;
2222
use phpDocumentor\Reflection\DocBlock\Tags\MethodParameter;
2323
use phpDocumentor\Reflection\DocBlock\Tags\Param;
24+
use phpDocumentor\Reflection\DocBlock\Tags\Return_;
2425
use phpDocumentor\Reflection\DocBlock\Tags\See;
26+
use phpDocumentor\Reflection\PseudoTypes\ConstExpression;
2527
use phpDocumentor\Reflection\Types\Array_;
2628
use phpDocumentor\Reflection\Types\Integer;
29+
use phpDocumentor\Reflection\Types\Mixed_;
30+
use phpDocumentor\Reflection\Types\Self_;
2731
use phpDocumentor\Reflection\Types\String_;
2832
use phpDocumentor\Reflection\Types\Void_;
2933
use PHPUnit\Framework\TestCase;
@@ -245,4 +249,23 @@ public function testInvalidTypeParamResultsInInvalidTag(): void
245249
$docblock->getTags()
246250
);
247251
}
252+
253+
public function testConstantReferenceTypes(): void
254+
{
255+
$docCommment = <<<DOC
256+
/**
257+
* @return self::STATUS_*
258+
*/
259+
DOC;
260+
261+
$factory = DocBlockFactory::createInstance();
262+
$docblock = $factory->create($docCommment);
263+
264+
self::assertEquals(
265+
[
266+
new Return_(new ConstExpression(new Self_(), 'STATUS_*'), new Description('')),
267+
],
268+
$docblock->getTags()
269+
);
270+
}
248271
}

0 commit comments

Comments
 (0)