Re: [RFC] [Discussion] Shorter Attribute Syntax Change
| From: | tyson andre | Date: | Thu, 30 Jul 2020 14:09:30 +0000 |
| Subject: | Re: [RFC] [Discussion] Shorter Attribute Syntax Change | ||
| References: | 1 2 3 4 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-111266@lists.php.net to get a copy of this message | ||
Hi David,
> I would like to suggests the syntax "using attribute(Attribute, ...)". It
> is more clear and should not create BC.
I'd agree that it's implementable and works with the tokenizer.
My main objection is the verbosity, which is the reason I assume many other languages have fairly
short/distinct attribute syntax.
```
// Assume Unused tells IDEs/analyzers/linters not to warn about unused parameters,
// and Override warns about a method not being an override
using attribute(Override)
public function apiMethod(
using attribute(Unused)
array $params,
using attribute(Unused)
bool $featureEnabled,
using attribute(Unused)
array $options,
) {...}
```
- Tyson