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

should return array<T of Foo> but returns array<T of Foo> #7460

Closed
VincentLanglet opened this issue Jun 11, 2022 · 5 comments
Closed

should return array<T of Foo> but returns array<T of Foo> #7460

VincentLanglet opened this issue Jun 11, 2022 · 5 comments
Labels
Milestone

Comments

@VincentLanglet
Copy link
Contributor

Bug report

Hi @ondrejmirtes, I'm getting an error that I don't understand at all
https://phpstan.org/r/1aa2d004-995a-4677-973e-17068b828291

I don't know if it's related but I can also produce another weird error with
https://phpstan.org/r/c74a81ae-f8ab-48e1-8bc4-62a2c02e8613

"expects T of Foo, got T of Foo".

@ondrejmirtes ondrejmirtes added this to the Generics milestone Jun 13, 2022
@VincentLanglet
Copy link
Contributor Author

Any clue where should I look at in the phpstan-src code to fix this @ondrejmirtes ?

@ondrejmirtes
Copy link
Member

You should \PHPStan\dumpType() the types in question and then you should check how the accepts() method of the involved type behaves and what needs to be fixed.

The rule in question is \PHPStan\Rules\Methods\ReturnTypeRule.

@rvanvelzen
Copy link
Contributor

Removing these lines seems to do the trick, in case you hadn't found a solution yet :)

@ondrejmirtes
Copy link
Member

Fixed, thank you! phpstan/phpstan-src@85ab8cf

@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 Jul 19, 2022
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