-
-
Notifications
You must be signed in to change notification settings - Fork 294
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
Fix nullable union type identifier lazy load #991
Fix nullable union type identifier lazy load #991
Conversation
Quick question as I haven't parsed the regex in my head yet: isn't this true for any unions and intersections? |
Current implementation only generate lazy loading identifier proxy for a single return type, which can be null. Is your question about supporting something like that? public function getId(): int|string|...|null
{
return $this->id;
} For intersection they are not supported by the regex, do you mean it could be supported? |
Yes. Instead of extra support for |
48b2471
to
ce8ef95
Compare
@malarzm I added support for union and intersection type. |
@deguif that's awesome! Would you mind adding a test for intersection as well? |
87618fa
to
941b370
Compare
PHPStan is complaining about the union with intersection type (for PHP 8.2). This should be fixed with the next release, as the reflection classes were updated to support union type with intersection type. |
4a0bc67
to
1809be6
Compare
@malarzm tests are green now. |
1809be6
to
a24b5fe
Compare
c7b5c4e
to
0b88bb5
Compare
0b88bb5
to
c67273f
Compare
c67273f
to
c187105
Compare
Amazing, thanks you very much for changes and clean history! 🍻 I'll try to review/merge/release this week |
Thanks @deguif! |
Currently using union type for identifiers method doesn't permit to lazy load the entity.
With this fix, only a union type for a single type and null is supported.
null
can be at first position or at last.For example:
This will enable lazy-loading (which previously was not):