-
Notifications
You must be signed in to change notification settings - Fork 99
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
Handle all hydration mode in QueryResultDynamicReturnTypeExtension #404
Conversation
681d38e
to
04aafa6
Compare
2794644
to
cdc7f30
Compare
Hi @arnaud-lb, I'm trying to improve #232 to supports all hydration modes. Do you mind taking a look ? |
eec9f2e
to
cefaeec
Compare
8d9b685
to
c96764c
Compare
c96764c
to
555c205
Compare
Hi @greg0ire, maybe you can help me on this. I'm not familiar with all the hydratation mode. |
Not super familiar either, but nothing strikes me as incorrect in what you wrote. |
Thanks, if you have a suggestion about who I should/could ping ; I'm open to it. @ondrejmirtes I would say, this is ready to be reviewed. |
{ | ||
$query = $em->createQuery(' | ||
SELECT m | ||
FROM QueryResult\Entities\Many m | ||
'); | ||
|
||
assertType( | ||
'mixed', | ||
'list<array>', |
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.
We should be more specific here - based on the entity, we should know the array shape.
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.
I agree. But I thought this could have been a good first step.
Wouldn't be ok to merge this and improve the array shape in a second PR ?
list<array>
is better than mixed,
then list<array{id: int, ...}>
will be better than list<array>
.
Also I had no idea how to improve the
if ($isObject->yes()) {
return new ArrayType(new MixedType(), new MixedType());
}
part with the PHPStan kit.
Yes, that's fine. I'm gonna merge this and test on real-world projects before releasing it. Thanks. |
I think it's mostly fine, but it can lead to new errors. Previously where there was
This is happening for |
But on a different project it leads to 108 new errors. So there are situations where it's wrong. Some examples:
leading to: Or:
leading to: Or:
leading to: Because of these problems, I'm gonna revert it now. Please send a new PR with improvements. Thank you. |
Thanks for the report. |
Closes #403