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
Phpdoc inheritance with generics #2909
Phpdoc inheritance with generics #2909
Conversation
You've opened the pull request against the latest branch 1.11.x. If your code is relevant on 1.10.x and you want it to be released sooner, please rebase your pull request and change its target to 1.10.x. |
I struggled to get something to work for |
Currently when an inherited method has an assert tag with a template type this template type isn't resolved which means you must override / copy the tag to the inherited method as well to make it work. This properly resolves the template type so the asserts properly work without copying.
606e689
to
8fa9eab
Compare
Looks like phpstan/phpstan#9123 is also fixed, can you please add a regression test? Thanks! |
I'm not sure I'm seeing what should be tested here which isn't the case already? The only difference in that example is the explicit Bu obviously I could just copy/paste the linked example into a |
Every fixed issue gets a regression test, regardless of whether the issue was exactly the same or not. These code snippets are very valuable and we should not throw them away. Please use this snippet https://phpstan.org/r/a9d9027b-da35-44f2-a757-de78dab88386 and do |
Closes phpstan/phpstan#10037 Closes phpstan/phpstan#9123
Okay, just adding an explicit test case for every fixed ticket 👍🏻
Done, and added both of your examples from phpstan/phpstan#10037 as well |
Perfect, thank you! |
This fixes the issue with inherited template types not being resolved in the context of
@phpstan-assert*
usage.For
@phpstan-self-out
I added some checks to the existing test to validate the (template) typeFixes phpstan/phpstan#10037