[RFC][Discussion] Harmonise "untyped" and "typed" properties

From: Date: Thu, 16 Nov 2023 20:41:38 +0000
Subject: [RFC][Discussion] Harmonise "untyped" and "typed" properties
Groups: php.internals 
Request: Send a blank email to internals+get-121700@lists.php.net to get a copy of this message
Hi all, I have finally written up an RFC I have been considering for some time: Harmonise "untyped" and "typed" properties RFC URL: https://wiki.php.net/rfc/mixed_vs_untyped_properties Currently, changing a property declaration from "private $foo" to "private mixed $foo" changes its behaviour in significant ways, even though no actual type checks are added. This RFC seeks to remove those differences, by extending the "uninitialized" state currently reserved for typed properties to cover all declared properties: * Properties without an initial value will be "uninitialized", not "null" * Calling "unset" on a declared property will make it "uninitialized", rather than the current complex behaviour There are a handful of open questions still in the RFC, but I wanted to present an initial draft to start the discussion, because the current behaviour is quite hard to explain in a short e-mail. Please let me know your thoughts. Regards, -- Rowan Tommins [IMSoP]

« previous php.internals (#121700) next »