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

take return-type into account while TemplateType validation #893

Closed
wants to merge 4 commits into from

Conversation

staabm
Copy link
Contributor

@staabm staabm commented Dec 28, 2021

while implementing #890 I realized that the newly added TemplateType validation does not take the return type into account:

grafik

this PR added return-type checking and fixes the reported phpstan error message accordingly.

@staabm staabm changed the title take return type into account while template type validation take return type into account while TemplateType validation Dec 28, 2021
@staabm staabm changed the title take return type into account while TemplateType validation take return-type into account while TemplateType validation Dec 28, 2021
@staabm staabm mentioned this pull request Dec 28, 2021
@ondrejmirtes
Copy link
Member

The original behaviour is correct. Function-scope template type that's not referenced in a parameter is useless. No @template tag + @return PDOStatement<array>|false would be equivalent signature.

@staabm staabm closed this Dec 28, 2021
@staabm staabm deleted the template-type-validation branch December 28, 2021 13:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants