Skip to content

Commit

Permalink
Test for special multiline PHPDoc
Browse files Browse the repository at this point in the history
  • Loading branch information
ondrejmirtes committed Sep 15, 2024
1 parent 5d48fa4 commit a5e938b
Showing 1 changed file with 79 additions and 0 deletions.
79 changes: 79 additions & 0 deletions tests/PHPStan/Parser/PhpDocParserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3881,6 +3881,46 @@ public function provideMultiLinePhpDocData(): iterable
new PhpDocTextNode('test'),
]),
];

yield [
'Real-world test case multiline PHPDoc',
'/**' . PHP_EOL .
' *' . PHP_EOL .
' * MultiLine' . PHP_EOL .
' * description' . PHP_EOL .
' * @param bool $a' . PHP_EOL .
' *' . PHP_EOL .
' * @return void' . PHP_EOL .
' *' . PHP_EOL .
' * @throws \Exception' . PHP_EOL .
' *' . PHP_EOL .
' */',
new PhpDocNode([
new PhpDocTextNode(''),
new PhpDocTextNode(
'MultiLine' . PHP_EOL .
'description'
),
new PhpDocTagNode('@param', new ParamTagValueNode(
new IdentifierTypeNode('bool'),
false,
'$a',
'',
false
)),
new PhpDocTextNode(''),
new PhpDocTagNode('@return', new ReturnTagValueNode(
new IdentifierTypeNode('void'),
''
)),
new PhpDocTextNode(''),
new PhpDocTagNode('@throws', new ThrowsTagValueNode(
new IdentifierTypeNode('\Exception'),
''
)),
new PhpDocTextNode(''),
]),
];
}

public function provideTemplateTagsData(): Iterator
Expand Down Expand Up @@ -7582,6 +7622,45 @@ public function dataTextBetweenTagsBelongsToDescription(): iterable
),
]),
];

yield [
'/**' . PHP_EOL .
' *' . PHP_EOL .
' * MultiLine' . PHP_EOL .
' * description' . PHP_EOL .
' * @param bool $a' . PHP_EOL .
' *' . PHP_EOL .
' * @return void' . PHP_EOL .
' *' . PHP_EOL .
' * @throws \Exception' . PHP_EOL .
' *' . PHP_EOL .
' */',
new PhpDocNode([
new PhpDocTextNode(
PHP_EOL .
'MultiLine' . PHP_EOL .
'description'
),
new PhpDocTagNode('@param', new ParamTagValueNode(
new IdentifierTypeNode('bool'),
false,
'$a',
'',
false
)),
new PhpDocTextNode(''),
new PhpDocTagNode('@return', new ReturnTagValueNode(
new IdentifierTypeNode('void'),
''
)),
new PhpDocTextNode(''),
new PhpDocTagNode('@throws', new ThrowsTagValueNode(
new IdentifierTypeNode('\Exception'),
''
)),
new PhpDocTextNode(''),
]),
];
}

/**
Expand Down

0 comments on commit a5e938b

Please sign in to comment.