On 27/05/2021 14:55, Andreas Leathley wrote:

When using isset on a non-nullable property a
static analyzer would rightfully complain that the property is not
nullable


Precisely, so don't mark a property as non-nullable and then leave it unset.


isset in this case is abused to check for uninitialized, hiding the
actual intent


On the contrary, the uninitialized state is what is being abused. If you want to make the intent clear, use a clear flag of "needs lazy-loading", or whatever you're actually using this magic "not null but not really anything else either" state for.


Regards,

--
Rowan Tommins
[IMSoP]

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: https://www.php.net/unsub.php

Reply via email to