mirror of
https://github.com/doctrine/orm.git
synced 2026-03-24 06:52:09 +01:00
Union type weirdness: nullable null for non-primitive types #6602
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @hktr92 on GitHub (Jan 11, 2021).
Hello.
Recently I've updated my PHP version to 8, Symfony to 5.2 and Doctrine 2.8.1.
I'm not sure if the problem is in ORM or DoctrineBundle, but I have an entity defined like so:
the only reason for using
AddressInterface|Addressis because of the huge code base and to be a helper to jump around the project.The problem is that the proxy generates the following invalid PHP code:
Using the
?Addressnotation works perfectly, but I can't say anything aboutAddress|nullas the profiler crashes to log (might be another problem in another place for this one, not related to Doctrine).For now, I'll change back these entities to use the old form.
LE: just for fun, I've changed the return type of
getAddress()to bestring|int|null, and it generatesstring|int|?null. so it applies to primitives too.@hktr92 commented on GitHub (Jan 14, 2021):
well... after further investigation i reached to the conclusion that this issue is useless to be open here.
it was weird because i thought that
doctrine/ormrelies onocramius/proxy-manager, but apparently,doctrine/migrationsrelies onfriendsofphp/proxy-manager-ltswhich replacesocramius/proxy-managerand they can't do anything unlessocramius/proxy-managerdoesn't have full php 8 support.oh boi, I love open source! [/sarcasm]