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
feature:generic resources #470
Conversation
Hi, First, you can make sure
|
I see!! Thank you! |
I believe I am now using |
4959aa7
to
fddb80d
Compare
6ae1083
to
869de2f
Compare
Although I haven't figured out how to solve
The tests are passing so I'm going to open this up for review. |
869de2f
to
0d1fac6
Compare
@canvural thank you for the review, feedback, and helping me learn about the workings of phpstan and generics. Would you mind giving this another review please? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to merge. One last thing. Can you add this change to CHANGELOG under Unreleased
?
0d1fac6
to
2297f6a
Compare
done @canvural :) |
resolves #437
I'm opening this up now to get feedback on if I am implementing correctly. I would appreciate some guidance as this is my first time working with generics and understanding what phpstan does behind the scenes.
Open Questions
getMethod
andgetProperty
. Off the top of my head, I would thinkreturn $modelType->getMethod($methodName);
however this requires a\PHPStan\Reflection\ClassMemberAccessAnswerer
parameter, and I'm not sure what that is or how to resolve it.$resource->foo()
is caught as an error.Improvements
Resource
without having to declareAt the top of resources? This is not ideal, and can hopefully be circumvented. I'm not sure how.
$templateTypeMap = $classReflection->getActiveTemplateTypeMap();
would resolve the model type, rather than having to fetch it via the first parent...