On Wed, Jun 17, 2015 at 2:05 PM, Christian Schneider <cschn...@cschneid.com> wrote:
> Hi there, > now that syntax for variadic functions was added I quickly wanted to ask > whether allowing trailing commas for function calls could be reconsidered. > > It is a very small change to the language allowing something like > my_variadic_function( > "foo", > "bar", > "qux", > ); > which makes adding/removing additional parameters a little easier: No > comma has to be added/removed from the last line. > > Previously this was considered unnecessary but maybe things changed enough > to reconsider it? It doesn't involve any BC break and I attached the very > simple patch needed in the master branch. > > If people still consider it more harm- than useful then please don't flame > me and I'll shut up again :-) > > Cheers, > - Chris > > > diff --git a/Zend/zend_language_parser.y b/Zend/zend_language_parser.y > index 9612324..f299f3e 100644 > --- a/Zend/zend_language_parser.y > +++ b/Zend/zend_language_parser.y > @@ -639,7 +639,7 @@ return_type: > > argument_list: > '(' ')' { $$ = zend_ast_create_list(0, ZEND_AST_ARG_LIST); > } > - | '(' non_empty_argument_list ')' { $$ = $2; } > + | '(' non_empty_argument_list possible_comma ')' { $$ = $2; } > ; > > non_empty_argument_list: > > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > hi, just linking to the previous rfc: https://wiki.php.net/rfc/trailing-comma-function-args and discussion: http://www.serverphorums.com/read.php?7,655532 -- Ferenc Kovács @Tyr43l - http://tyrael.hu