Re: [RFC] Property Accessors v1.2 : Extra shorthand declaration
| From: | Levi Morrison | Date: | Fri, 26 Oct 2012 15:18:52 +0000 |
| Subject: | Re: [RFC] Property Accessors v1.2 : Extra shorthand declaration | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-63652@lists.php.net to get a copy of this message | ||
> ------------------------------------------------------------------------
> *Extra shorthand declaration*
>
> Allow extra short declaration of an accessor:
>
> class TimePeriod {
> public DateTime $date;
> }
>
> /* Would be equivalent to this */
>
> class TimePeriod {
> public $date {
> get() { return $this->date; }
> set(DateTime $value) { $this->date = $value;}
> }
> }
This is lovely. Full support from me.
I just have one question: can we drop
public? Default visibility in
methods is public, so maybe we can drop it when using type-hinted
properties? Just an idea; no worries if it needs to stay.