> Le 22 nov. 2023 à 23:17, Rowan Tommins <rowan.coll...@gmail.com> a écrit : > > I'm probably going to regret asking this, but is there some reason it works > that way? Is there any chance of changing it to just: > >> Typed properties start off as uninitialized. >> >> Once you've assigned a value, you can't go back to the original >> uninitialized state using unset() >> >> Accessing an uninitialized property will first check for __get, and throw an >> error if that isn't defined.
Hi Rowan, What you describe in the last sentence is what was initially designed and implemented by the RFC: https://wiki.php.net/rfc/typed_properties_v2 (section Overloaded Properties). However, it was later changed to the current semantics (unset() needed in order to trigger __get()) in https://github.com/php/php-src/pull/4974 —Claude