Re: [RFC] Alternative typehinting syntax for accessors
| From: | Levi Morrison | Date: | Fri, 04 Jan 2013 23:44:48 +0000 |
| Subject: | Re: [RFC] Alternative typehinting syntax for accessors | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-64536@lists.php.net to get a copy of this message | ||
On Fri, Jan 4, 2013 at 4:34 PM, Levi Morrison <levim@php.net> wrote:
>>We should also consider how an author would allow type-hinted properties to accept NULL as a
>>new value, in both proposals.
>
> public $foo {
> get;
> set(Foo $value = NULL) { $this->foo = $value; }
> }
>
> Would work for traditional type-hints.
I just realized that
unset would actually have a use here. Rather
than setting something to null you would unset it.