RFC: https://wiki.php.net/rfc/trailing_comma_in_parameter_list
Closes GH-5306.
RFC: https://wiki.php.net/rfc/abstract_trait_method_validation
. `throw` can now be used as an expression.
RFC: https://wiki.php.net/rfc/throw_expression
+ . An optional trailing comma is now allowed in parameter lists.
+ RFC: https://wiki.php.net/rfc/trailing_comma_in_parameter_list
- Date:
. Added DateTime::createFromInterface() and
--- /dev/null
+--TEST--
+Trailing comma in function signatures
+--FILE--
+<?php
+
+function test(
+ $there,
+ $are,
+ $many,
+ $params,
+) {
+ echo "Foo\n";
+}
+
+class Test {
+ public function method(
+ $there,
+ $are,
+ $many,
+ $params,
+ ) {
+ echo "Foo\n";
+ }
+}
+
+$func = function(
+ $there,
+ $are,
+ $many,
+ $params,
+) {
+ echo "Foo\n";
+};
+
+$func = fn(
+ $there,
+ $shouldnt,
+ $be,
+ $many,
+ $params,
+) => print "Foo\n";
+
+?>
+===DONE===
+--EXPECT--
+===DONE===
;
parameter_list:
- non_empty_parameter_list { $$ = $1; }
+ non_empty_parameter_list possible_comma { $$ = $1; }
| %empty { $$ = zend_ast_create_list(0, ZEND_AST_PARAM_LIST); }
;