-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Parser does not see docComments between attributes and class declaration #762
Comments
The parser only collects comments before a node -- as the attributes are considered part of the class, the doc comment ends up being "inside" the class, and thus lost. It's not really possible to fix this with the current architecture. |
Alright, thanks! This is probably the same issue: class HelloWorld
{
#[Groups]
#[Valid]
/** @var \stdClass[]|null */
public ?array $damages = null;
} |
given this php code if (
/** @authdoc-c (i18n="foobar") */
!check("view", "foobar") &&
/** @authdoc-c (i18n="barfoo") */
(empty($myGroups[$groupId]) || !check($myGroups[$groupId], "barfoo"))
) the second docblock is not seen as well. I guess it is a similar problem. |
It seems to me, using #[Attr]
final
class
A {} But it's less likely than #[Attr]
final class A {} |
Given this PHP code:
PHP itself sees both attribute and doc comment: https://3v4l.org/Pe17n
But PHP-Parser doesn't (
bin/php-parse
output on PHP 7.4):Original report: phpstan/phpstan#4633
The text was updated successfully, but these errors were encountered: