mirror of
https://github.com/danog/phpdoc-parser.git
synced 2025-01-22 22:01:36 +01:00
Wildcard constants
This commit is contained in:
parent
4f03df6e39
commit
3170d7d858
@ -111,6 +111,12 @@ class TypeParser
|
||||
if ($constExpr instanceof Ast\ConstExpr\ConstExprArrayNode) {
|
||||
throw $exception;
|
||||
}
|
||||
if ($constExpr instanceof Ast\ConstExpr\ConstFetchNode) {
|
||||
if ($tokens->currentTokenValue() === '*') {
|
||||
$tokens->consumeTokenType($tokens->currentTokenType());
|
||||
$constExpr = new Ast\ConstExpr\ConstFetchNode($constExpr->className, $constExpr->name . '*');
|
||||
}
|
||||
}
|
||||
return new Ast\Type\ConstTypeNode($constExpr);
|
||||
} catch (\LogicException $e) {
|
||||
throw $exception;
|
||||
|
@ -854,6 +854,17 @@ class TypeParserTest extends \PHPUnit\Framework\TestCase
|
||||
'"bar"',
|
||||
new ConstTypeNode(new ConstExprStringNode('bar')),
|
||||
],
|
||||
[
|
||||
'Foo::FOO_*',
|
||||
new ConstTypeNode(new ConstFetchNode('Foo', 'FOO_*')),
|
||||
],
|
||||
[
|
||||
'( "foo" | Foo::FOO_* )',
|
||||
new UnionTypeNode([
|
||||
new ConstTypeNode(new ConstExprStringNode('foo')),
|
||||
new ConstTypeNode(new ConstFetchNode('Foo', 'FOO_*')),
|
||||
]),
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user