-
Notifications
You must be signed in to change notification settings - Fork 82
Closed
Description
https://externals.io/message/110217 [RFC] Amendments to Attributes is proposing changing the final syntax
https://wiki.php.net/rfc/attributes_v2 is in the voting phase - there are currently 48 yes votes and 1 no vote, and <<Attribute(optional arg list)>> is the preferred syntax.
This RFC proposes Attributes as a form of structured, syntactic metadata to declarations of classes, properties, functions, methods, parameters and constants.
Relevant parts of the CFG in the implementation PR in Zend/zend_language_parser.y
attribute_arguments:
expr
{ $$ = zend_ast_create_list(1, ZEND_AST_ARG_LIST, $1); }
| attribute_arguments ',' expr
{ $$ = zend_ast_list_add($1, $3); }
;
attribute_decl:
class_name_reference
{ $$ = zend_ast_create(ZEND_AST_ATTRIBUTE, $1, NULL); }
| class_name_reference '(' ')'
{ $$ = zend_ast_create(ZEND_AST_ATTRIBUTE, $1, NULL); }
| class_name_reference '(' attribute_arguments ')'
{ $$ = zend_ast_create(ZEND_AST_ATTRIBUTE, $1, $3); }
;
attribute:
T_SL attribute_decl T_SR { $$ = $2; }
;
attributes:
attribute { $$ = zend_ast_create_list(1, ZEND_AST_ATTRIBUTE_LIST, $1); }
| attributes attribute { $$ = zend_ast_list_add($1, $2); }
;Metadata
Metadata
Assignees
Labels
No labels