Re: [RFC][Vote] Typed Properties
| From: | James Gilliland | Date: | Thu, 26 May 2016 15:02:46 +0000 |
| Subject: | Re: [RFC][Vote] Typed Properties | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-93568@lists.php.net to get a copy of this message | ||
>
> If you want, you can easily write a backwards-compatible new class that
> uses declared type properties with
> public int $property = null;
And for those pesky third party libraries that forgot to set = NULL on
their property definition there's a backwards compatible accessor too.
$foo = $obj->bar ?? NULL;
Sarcasm aside, I still can't figure out how fundamentally changing how
people interact with uninitialized properties like this improves developer
experience. Can someone explain a case where this is better and catches a
bug or something? Since this is a new feature I would assume its not
covered by "BC" but this seems like a painful gotcha for people developing
across typed and untyped code.