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

Template return type is not enforced since v1.4.6 #6588

Closed
mvorisek opened this issue Feb 7, 2022 · 3 comments
Closed

Template return type is not enforced since v1.4.6 #6588

mvorisek opened this issue Feb 7, 2022 · 3 comments

Comments

@mvorisek
Copy link
Contributor

mvorisek commented Feb 7, 2022

Bug report

based on discussion #6575 (comment)

Until phpstan v1.4.6 this was working with level 6. Since phpstan v1.4.6 level 7 is required.

I do not understand why and I belive it is a bug.

/cc @arnaud-lb

Code snippet that reproduces the problem

https://phpstan.org/r/3eb789f9-8b3b-442b-97a9-94b6e8d80438

https://phpstan.org/r/fe43eab5-015b-47ad-b3b0-acbf7228dd27 even more problematic usecase @template-covariant TField of Field2, but returning Field

Expected output

EntityFieldPair::getField() is documented to return template type TField so when returning Field, error must be emit. This was working until phpstan v1.4.6.

@ondrejmirtes
Copy link
Member

Yes, it was intentionaly moved to level 7: phpstan/phpstan-src#999 (comment)

@mvorisek
Copy link
Contributor Author

mvorisek commented Feb 7, 2022

At least the 2nd example is not detected correctly, but simple type usecase is: https://phpstan.org/r/09870e54-2bc7-4560-a95d-fab83ede23f8

@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 11, 2022
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