4 ms·
PHP 7.4 adds optional type declarations for properties on an object, and so there was the problem of how to avoid an inconsistent state (type not matching befor
by TazeTSchnitzel 7y ago
PHP 7.4 adds optional type declarations for properties on an object, and so there was the problem of how to avoid an inconsistent state (type not matching before initialisation). The route that was eventually taken was to have the properties not be null, but be unset. If you try to read from them at runtime without having written to them first, an error is thrown. Notably, there's no requirement everything be defined when the constructor exits.
- draw_down 7y agoThat’s not really addressing the issue though, it’s just passing the potato so the developer can decide what to do with it.