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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem mixing attributes and docblock #4963

Closed
temp opened this issue May 5, 2021 · 5 comments
Closed

Problem mixing attributes and docblock #4963

temp opened this issue May 5, 2021 · 5 comments

Comments

@temp
Copy link

temp commented May 5, 2021

Bug report

phpstan version is 0.12.85

Mixing attributes and docblock in the order attributes, docblock results in this error:

 22     Property ...\WheelInput::$damages type has no value type specified in iterable type array.
         馃挕 See: https://phpstan.org/blog/solving-phpstan-no-value-type-specified-in-iterable-type

The error does not show when changing order, but shouldn't both cases be valid? Our phpcs rules (slevomat) fail when having it the other way round.
Is there a preferred way of mixing apidoc and attributes?

Code snippet that reproduces the problem

    #[Groups(['read', 'write'])]
    #[Valid]
    /** @var DamageInput[]|null */
    public ?array $damages = null;

Expected output

No error

@mergeable
Copy link

mergeable bot commented May 5, 2021

This bug report is missing a link to reproduction on phpstan.org.

It will most likely be closed after manual review.

@temp
Copy link
Author

temp commented May 5, 2021

Reproduction: https://phpstan.org/r/1e6e568b-1bec-4201-84af-b1434a219043
Sorry for the attribute-errors, I guess these can be ignored.

@ondrejmirtes
Copy link
Member

This is probably really hard to solve because of nikic/PHP-Parser#762

@ondrejmirtes
Copy link
Member

As it's a duplicate of #4633, I'm closing this. Thanks!

@github-actions
Copy link

github-actions bot commented Jul 1, 2021

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 Jul 1, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants