Re: [RFC] Alternative typehinting syntax for accessors
| From: | Nikita Popov | Date: | Sun, 20 Jan 2013 16:02:33 +0000 |
| Subject: | Re: [RFC] Alternative typehinting syntax for accessors | ||
| References: | 1 2 3 4 5 6 7 8 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-65045@lists.php.net to get a copy of this message | ||
On Sun, Jan 20, 2013 at 4:47 PM, Clint Priest <cpriest@zerocue.com> wrote:
>
> On 1/20/2013 9:26 AM, Nikita Popov wrote:
>
>> I now added a patch for this proposal:
>> https://gist.github.com/**4579298<https://gist.github.com/4579298>(For
>> more detailed individual commits see here:
>>
>> https://github.com/nikic/php-**src/commits/alternativeSyntax<https://github.com/nikic/php-src/commits/alternativeSyntax>
>> )
>>
> One thing I hadn't noticed is that the proposal was to move the typehint,
> what happens in this case then:
>
> public DateTime $date {
> get;
> set(stdClass $value);
> }
>
> Would the above produce a compilation error on the stdClass part?
>
Yes, that's an error. And I'm not sure what that is supposed to mean in the
first place (it has two different typehints at two different places...)
This proposal will allow a typehint before the property name and only
there. Allowing one in both places doesn't make much sense to me.
Nikita