Parse assert-if-true and assert-if-false as well

This commit is contained in:
Richard van Velzen 2022-05-01 10:46:17 +02:00 committed by Ondřej Mirtes
parent 0af5cba9f1
commit 47051f5ca6
2 changed files with 33 additions and 0 deletions

View File

@ -206,7 +206,11 @@ class PhpDocParser
break;
case '@phpstan-assert':
case '@phpstan-assert-if-true':
case '@phpstan-assert-if-false':
case '@psalm-assert':
case '@psalm-assert-if-true':
case '@psalm-assert-if-false':
$tagValue = $this->parseAssertTagValue($tokens);
break;

View File

@ -3565,6 +3565,35 @@ some text in the middle'
),
]),
];
yield [
'OK assert-if-true',
'/** @phpstan-assert-if-true Type $var */',
new PhpDocNode([
new PhpDocTagNode(
'@phpstan-assert-if-true',
new AssertTagValueNode(
new IdentifierTypeNode('Type'),
'$var',
''
)
),
]),
];
yield [
'OK assert-if-false',
'/** @phpstan-assert-if-false Type $var */',
new PhpDocNode([
new PhpDocTagNode(
'@phpstan-assert-if-false',
new AssertTagValueNode(
new IdentifierTypeNode('Type'),
'$var',
''
)
),
]),
];
}
public function providerDebug(): Iterator