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

Support contravariant template types #2051

Merged
merged 6 commits into from
Dec 5, 2022

Conversation

jiripudil
Copy link
Contributor

Closes phpstan/phpstan#3960.

Basically, I'm picking up where #1492 left off, with a couple more tests.

Once this lands, I'd like to follow up with a fix to the bug mentioned in the original PR (#1492 (comment)). The logs are no longer available for the relevant builds, but I understand it caused some turmoil, and should therefore be discussed separately.

Copy link
Member

@ondrejmirtes ondrejmirtes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd like some "accepts" tests, meaning "does this parameter accept this argument"? For example in CallMethodsRuleTest, to see that the objects behave correctly :)

@jiripudil
Copy link
Contributor Author

I'm assuming you have something like this in mind? Otherwise, apart from a detail irrelevant to this case, GenericObjectType::accepts() shares the implementation with isSuperTypeOf() which is already covered by tests. But can't hurt to have an integration test on top of that :)

@ondrejmirtes
Copy link
Member

Yes, thank you :)

@ondrejmirtes ondrejmirtes merged commit 024e98e into phpstan:1.9.x Dec 5, 2022
@jiripudil jiripudil deleted the template-contravariant branch December 5, 2022 20:33
@oprypkhantc
Copy link

Thank you for picking up on it @jiripudil :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Contravariant bounds in generics
3 participants