Re: Types on the right or on the left
| From: | Levi Morrison | Date: | Tue, 04 Nov 2014 19:55:02 +0000 |
| Subject: | Re: Types on the right or on the left | ||
| References: | 1 2 3 4 5 6 7 8 9 10 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-78674@lists.php.net to get a copy of this message | ||
On Tue, Nov 4, 2014 at 11:48 AM, Stas Malyshev <smalyshev@sugarcrm.com> wrote:
> Hi!
>
>> But it’s rather weird for closures:
>>
>> $foo = Foo function () {
>> };
>
> Not much weirder than:
>
> $foo = static function () { ... }
>
> which we already have. Putting modifiers in front of the function is
> nothing foreign to PHP.
This syntax is one reason that this approach is *not* taken. While
this RFC does not propose or implement a return type of static, it
could be done in the foreseeable future. Your proposed syntax would
then be ambiguous.