-
Notifications
You must be signed in to change notification settings - Fork 112
fixes #700; add TResult usage to AbstractQuery.stub #701
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
Conversation
|
Please add a failing test showing what kind of problem this solves. |
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.
TResult is already used by
https://github.com/phpstan/phpstan-doctrine/blob/31a924b443a3c15a851c3a8bd0a9f672d3aedc35/src/Type/Doctrine/Query/QueryResultDynamicReturnTypeExtension.php
which rely on
https://github.com/phpstan/phpstan-doctrine/blob/31a924b443a3c15a851c3a8bd0a9f672d3aedc35/src/Type/Doctrine/HydrationModeReturnTypeResolver.php
And it gives better return type than the one added in the stub because they also rely on TKey
|
And yet it doesn't work in my environment. @ondrejmirtes Thought it was because I didn't have the config right, but I did have config according to docs as noted above. So, maybe something is off in my environment, but I have looked in vain for months. May be some issue that arrived when there is lots of abstraction, inheritance, and generics If you have an idea let me know, but I've provided examples above |
|
The OP's issue isn't "TResult is unused". His issue is "getOneOrNullResult returns mixed". Which is by design because today we do not know the hydration mode. |
|
Yeah that sounds right. My issue is mixed returns. The real ripening being discovered |
I saw your example #700 (comment) And I think it should work with As explained by ondrej, currently we annot be sure about
I assume this would require a third template parameter on the Query stub... |
|
This is very interesting. I will test this next week and get back to you! |
I'll try to improve this situation with #702 |
|
holy crap, @VincentLanglet, that solved the headache I've been working around for many months now! How silly of me to not see that option, I am so grateful that you chimed in to point me in the right direction!! If #702 is workable, it seems like a great idea, as hydrating the object seems like a logical default assumption for this package. Thanks again, you make my week. |
#700
phpstan/phpstan#10906 (comment)