Re: [RFC] Alternative typehinting syntax for accessors
| From: | Steve Clay | Date: | Sat, 05 Jan 2013 22:27:20 +0000 |
| Subject: | Re: [RFC] Alternative typehinting syntax for accessors | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-64562@lists.php.net to get a copy of this message | ||
On 1/4/13 9:41 AM, Nikita Popov wrote:
https://wiki.php.net/rfc/propertygetsetsyntax-alternative-typehinting-syntaxI like the proposal so far. I'm still a little hesitant about syntax for allowing the setting of NULL values. Since properties are NULL by default (I wish this were explicit in the docs), these are _completely equivalent_: public $f; public $f = null; So it bothers me that these would result in different behavior: public Foo $f; public Foo $f = null; Now, all properties with an object type must be NULL initially, so really we're deciding whether a property can be set *back* to NULL (outside the setter). We could just make the most common case the default behavior. Otherwise the author must provide the signature of the setter with/without "= null". Steve Clay -- http://www.mrclay.org/