You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We have some (mostly legacy) code which makes use of inline PHPDoc tags within other tags, for example the @copyright line in the following example contains an inline @link tag:
/** * Unit tests for stored_progress_bar_cleanup * * @package core * @copyright 2024 onwards Catalyst IT EU {@link https://catalyst-eu.net} * @author Mark Johnson <mark.johnson@catalyst-eu.net> * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later * @covers \core\task\stored_progress_bar_cleanup_task */
When Rector's BetterDocsParser processes this using phpstan\phpdoc-parser I'm seeing that the processing stops at the @copyright line just before the inline tag.
From a quick dive into the code it looks like this may be an issue with \PHPStan\PhpDocParser\Parser\PhpDocParser::parseOptionalDescriptionAfterDoctrineTag, which correctly identifies the @link tag, but because it is a Ast\PhpDoc\GenericTagValueNode, it stops processing the rest of the docblock tags any further.
We have some (mostly legacy) code which makes use of inline PHPDoc tags within other tags, for example the
@copyright
line in the following example contains an inline@link
tag:When Rector's BetterDocsParser processes this using
phpstan\phpdoc-parser
I'm seeing that the processing stops at the@copyright
line just before the inline tag.From a quick dive into the code it looks like this may be an issue with
\PHPStan\PhpDocParser\Parser\PhpDocParser::parseOptionalDescriptionAfterDoctrineTag
, which correctly identifies the@link
tag, but because it is aAst\PhpDoc\GenericTagValueNode
, it stops processing the rest of the docblock tags any further.phpdoc-parser/src/Parser/PhpDocParser.php
Lines 255 to 262 in 04c8de0
As a result the only tags returned are:
Given there is no authoritative PHPDoc reference it's hard to determine what the correct behaviour is here.
The phpDocumentor manual states that the
inline {@link}
tag is to:The FIG proposal does not provide any guidance that I can see on the use of inline tags, beyond that fact that they exist and that
@link
is a valid inline tag.https://github.com/php-fig/fig-standards/blob/master/proposed/phpdoc-tags.md
However the format of the copyright tag is a bit uncertain.
The phpDocumentor manual states that it is used unaltered:
The FIG proposal states that the coding style is up to the indvidual project:
The same statement is also used in phpdoc:
https://docs.phpdoc.org/guide/references/phpdoc/tags/copyright.html
Given all of the above, I would argue that the parsing of these tags in phpdoc-parser is incorrect and that they should either:
The text was updated successfully, but these errors were encountered: