Skip to content
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

return type has no value type specified in iterable type array if a docbock goes after php8 attributes #6502

Closed
fluffycondor opened this issue Feb 1, 2022 · 5 comments
Labels

Comments

@fluffycondor
Copy link
Contributor

Bug report

By RFC (https://wiki.php.net/rfc/attributes_v2) there's no difference in attributes and docblock order.

Attributes are added before the declaration they belong to, similar to doc-block comments. They can be declared before or after a doc-block comment that documents a declaration.

But if I put a docblock after an attribute, I get return type has no value type specified in iterable type array here, as if there's no this docblock:
https://phpstan.org/r/aa3b06c9-7292-47e6-a986-8ccf904890ef

If I put the docblock before an attribute it works as expected:
https://phpstan.org/r/9fda8bec-7a0b-4cbc-8fb2-49d24172429b

Code snippet that reproduces the problem

https://phpstan.org/r/aa3b06c9-7292-47e6-a986-8ccf904890ef

Expected output

No errors.

Did PHPStan help you today? Did it make you happy in any way?

I love PHPStan <3

@ondrejmirtes
Copy link
Member

Unfortunately this is an issue in nikic/PHP-Parser: nikic/PHP-Parser#762

Recently I've got an idea how to work around it, stay tuned :)

@atournayre
Copy link

Some news about this issue and your idea @ondrejmirtes?
I'm using PHPStan for the first time and, not luck I'm facing this.
Otherwise it's super cool and report lots of stuff, thanks for your work.

@ondrejmirtes
Copy link
Member

No need to ask - unless the linked issue is solved, there's no update.

@ondrejmirtes
Copy link
Member

Duplicate of #4633

@ondrejmirtes ondrejmirtes marked this as a duplicate of #4633 Feb 8, 2023
@github-actions
Copy link

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 12, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants