Handle all hydration mode in QueryResultDynamicReturnTypeExtension#404
Handle all hydration mode in QueryResultDynamicReturnTypeExtension#404ondrejmirtes merged 1 commit intophpstan:1.3.xfrom
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. |
|
|
||
| assertType( | ||
| 'mixed', | ||
| 'list<array>', |
There was a problem hiding this comment.
We should be more specific here - based on the entity, we should know the array shape.
There was a problem hiding this comment.
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