Hi Niels On Sun, Jan 26, 2025 at 7:43 PM Niels Dossche <dossche.ni...@gmail.com> wrote: > > I'm looking for feedback on a bugfix for > https://github.com/php/php-src/issues/12856. > Fix PR: https://github.com/php/php-src/pull/17590 > > So the alternative idea, the one implemented in my PR, would be this: > > - If the property is uninitialized, and $def_value is not provided, then > throw a ReflectionException with message "Property ... is not initialized and > no default was provided". > - If the property is uninitialized, and $def_value IS provided, then return > $def_value. > - In all other cases, the behaviour stays the same as it was.
I agree that this is the right approach. The proposed behavior is also in line with native property access, with or without ??. https://3v4l.org/S3mf8 Ilija