Re: [RFC] PHP Attributes
| From: | Fleshgrinder | Date: | Mon, 25 Apr 2016 20:20:32 +0000 |
| Subject: | Re: [RFC] PHP Attributes | ||
| References: | 1 2 3 4 5 6 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-92757@lists.php.net to get a copy of this message | ||
On 4/25/2016 10:04 PM, Rowan Collins wrote:
> On 25/04/2016 19:37, Stanislav Malyshev wrote:
>> Hi!
>>
>>> @attr() - is a valid "silenced" call to function named "attr".
>>> This syntax can't be reused.
>> Not valid if it's in the middle of class definition, and not valid in
>> form of:
>>
>> @attr() function foo() { ... }
>>
>> This is not a valid PHP syntax now. So I'm not sure why it can't be
>> used. << is an operator too and so is >> .
>>
>
> No, but this is valid:
>
> @atrr(); function foo() { ... }
>
> That's perhaps a little too close for comfort...?
>
> Regards,
>
Actually I agree with Stanislav (in pretty much every point he made so
far) on the syntax discussion, however, I already said that the brackets
are the main problem and it seems as it nobody sees it but your example
illustrates it perfectly.
@fopen('file', 'r'); function foo(){}
@deprecated function foo(){}
@throws InvalidArgumentException function foo(){}
@route ['name' => 'foo'] function foo(){}
Leaving out the brackets makes it very clear. I am in an extreme rush
and will read more in the thread the next days, sorry.
--
Richard "Fleshgrinder" Fussenegger
Attachment: [application/pgp-signature] OpenPGP digital signature signature.asc
Attachment: [application/pgp-signature] OpenPGP digital signature signature.asc