mirror of
https://github.com/danog/phpdoc-parser.git
synced 2024-11-30 04:29:20 +01:00
Combine multiple line deprecation messages
This commit is contained in:
parent
847540a54b
commit
deaac7cd4b
@ -170,7 +170,18 @@ class PhpDocParser
|
||||
|
||||
private function parseDeprecatedTagValue(TokenIterator $tokens): Ast\PhpDoc\DeprecatedTagValueNode
|
||||
{
|
||||
$description = $this->parseOptionalDescription($tokens);
|
||||
$description = '';
|
||||
while ($tokens->currentTokenType() !== Lexer::TOKEN_CLOSE_PHPDOC) {
|
||||
$description .= $tokens->joinUntil(Lexer::TOKEN_PHPDOC_EOL, Lexer::TOKEN_CLOSE_PHPDOC, Lexer::TOKEN_END);
|
||||
$description = rtrim($description, " \t");
|
||||
if ($tokens->currentTokenType() !== Lexer::TOKEN_PHPDOC_EOL) {
|
||||
break;
|
||||
}
|
||||
// There's more text on a new line, ensure spacing.
|
||||
$description .= ' ';
|
||||
$tokens->next();
|
||||
}
|
||||
$description = rtrim($description, " \t");
|
||||
return new Ast\PhpDoc\DeprecatedTagValueNode($description);
|
||||
}
|
||||
|
||||
|
@ -1004,11 +1004,34 @@ class PhpDocParserTest extends \PHPUnit\Framework\TestCase
|
||||
new PhpDocNode([
|
||||
new PhpDocTagNode(
|
||||
'@deprecated',
|
||||
new DeprecatedTagValueNode('in Drupal 8.6.0 and will be removed before Drupal 9.0.0. In')
|
||||
new DeprecatedTagValueNode('in Drupal 8.6.0 and will be removed before Drupal 9.0.0. In Drupal 9 there will be no way to set the status and in Drupal 8 this ability has been removed because mb_*() functions are supplied using Symfony\'s polyfill.')
|
||||
),
|
||||
]),
|
||||
];
|
||||
yield [
|
||||
'OK with multiple and long descriptions',
|
||||
'/**
|
||||
* Sample class
|
||||
*
|
||||
* @author Foo Baz <foo@baz.com>
|
||||
*
|
||||
* @deprecated in Drupal 8.6.0 and will be removed before Drupal 9.0.0. In
|
||||
* Drupal 9 there will be no way to set the status and in Drupal 8 this
|
||||
* ability has been removed because mb_*() functions are supplied using
|
||||
* Symfony\'s polyfill.
|
||||
*/',
|
||||
new PhpDocNode([
|
||||
new PhpDocTextNode('Sample class'),
|
||||
new PhpDocTextNode(''),
|
||||
new PhpDocTagNode(
|
||||
'@author',
|
||||
new GenericTagValueNode('Foo Baz <foo@baz.com>')
|
||||
),
|
||||
new PhpDocTextNode(''),
|
||||
new PhpDocTagNode(
|
||||
'@deprecated',
|
||||
new DeprecatedTagValueNode('in Drupal 8.6.0 and will be removed before Drupal 9.0.0. In Drupal 9 there will be no way to set the status and in Drupal 8 this ability has been removed because mb_*() functions are supplied using Symfony\'s polyfill.')
|
||||
),
|
||||
new PhpDocTextNode('Drupal 9 there will be no way to set the status and in Drupal 8 this'),
|
||||
new PhpDocTextNode('ability has been removed because mb_*() functions are supplied using'),
|
||||
new PhpDocTextNode('Symfony\'s polyfill.'),
|
||||
]),
|
||||
];
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user