rfc:attribute_amendments
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
rfc:attribute_amendments [2020/06/04 09:11] – beberlei | rfc:attribute_amendments [2020/06/08 08:10] – Start vote beberlei | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== PHP RFC: Attribute Amendments ====== | ====== PHP RFC: Attribute Amendments ====== | ||
- | * Version: 1.0 | + | * Version: 1.2 |
* Date: 2020-05-11 | * Date: 2020-05-11 | ||
* Author: Benjamin Eberlei (beberlei@php.net), | * Author: Benjamin Eberlei (beberlei@php.net), | ||
* Status: Under Discussion | * Status: Under Discussion | ||
+ | * Target: 8.0 | ||
* First Published at: http:// | * First Published at: http:// | ||
Line 70: | Line 71: | ||
</ | </ | ||
+ | This feature would be superseded by any other RFC getting accepted that changes the syntax. | ||
===== Validate Attribute Target Declarations ===== | ===== Validate Attribute Target Declarations ===== | ||
Line 127: | Line 129: | ||
public const int TARGET_ALL = ((1 << 6) - 1); | public const int TARGET_ALL = ((1 << 6) - 1); | ||
- | public function __construct(int $target | + | public function __construct(int $flags = self:: |
{ | { | ||
} | } | ||
Line 144: | Line 146: | ||
For this reason we propose that by default attributes are not repeatable, and only | For this reason we propose that by default attributes are not repeatable, and only | ||
- | if the attribute has the //RepeatableAttribute// attribute in addition to //PhpAttribute// | + | if the //PhpAttribute// has the flag //IS_REPEATABLE// |
should it be possible to use it multiple times on the same declaration: | should it be possible to use it multiple times on the same declaration: | ||
<code php> | <code php> | ||
- | << | + | class PhpAttribute |
+ | { | ||
+ | public const int IS_REPEATABLE = ((1 << 10)); | ||
+ | } | ||
+ | |||
+ | << | ||
class Route | class Route | ||
{ | { | ||
Line 163: | Line 170: | ||
</ | </ | ||
- | An alternative approach would be to introduce a second argument to // | + | Important note: The repeatable |
- | + | ||
- | <code php> | + | |
- | << | + | |
- | class Route | + | |
- | { | + | |
- | } | + | |
- | + | ||
- | // with named parameters: | + | |
- | << | + | |
- | class Route | + | |
- | { | + | |
- | } | + | |
- | </ | + | |
- | + | ||
- | Important note: The repeatable | + | |
In fact it does not influence a call to // | In fact it does not influence a call to // | ||
from this method, that are not valid on the reflected declaration. This is in line with the deferred validation of userland attributes | from this method, that are not valid on the reflected declaration. This is in line with the deferred validation of userland attributes | ||
Line 207: | Line 199: | ||
===== Open Issues ===== | ===== Open Issues ===== | ||
- | - For repeated attribute declaration: | + | none |
+ | ===== Vote ===== | ||
- | ===== Proposed | + | Voting |
- | - Should | + | ==== Rename PhpAttribute class to Attribute ==== |
- | | + | |
- | | + | <doodle title=" |
- | | + | * Yes |
+ | * No | ||
+ | </ | ||
+ | |||
+ | ==== Group statement for Attributes ==== | ||
+ | |||
+ | <doodle title=" | ||
+ | * Yes | ||
+ | * No | ||
+ | </ | ||
+ | |||
+ | ==== Validate Attribute Target Declarations ==== | ||
+ | |||
+ | <doodle title=" | ||
+ | * Yes | ||
+ | * No | ||
+ | </ | ||
+ | |||
+ | ==== Validate Attribute Repeatability ==== | ||
+ | |||
+ | <doodle title=" | ||
+ | * Yes | ||
+ | * No | ||
+ | </ | ||
===== Patches and Tests ===== | ===== Patches and Tests ===== | ||
Line 225: | Line 241: | ||
- [[https:// | - [[https:// | ||
+ | | ||
+ | ===== Updates ===== | ||
+ | |||
+ | - 1.0 Initial RFC (11.5.2020) | ||
+ | - 1.1 Attributes\Attribute namespace (28.5.2020) | ||
+ | - 1.2 Revert Attributes\Attribute namespace, make IS_REPEATABLE flag on PhpAttribute (4.6.2020) | ||
rfc/attribute_amendments.txt · Last modified: 2020/06/29 09:07 by beberlei