File tree Expand file tree Collapse file tree 3 files changed +49
-1
lines changed Expand file tree Collapse file tree 3 files changed +49
-1
lines changed Original file line number Diff line number Diff line change @@ -462,6 +462,8 @@ PHP 8.0 UPGRADE NOTES
462
462
RFC: https://wiki.php.net/rfc/abstract_trait_method_validation
463
463
. `throw` can now be used as an expression.
464
464
RFC: https://wiki.php.net/rfc/throw_expression
465
+ . An optional trailing comma is now allowed in parameter lists.
466
+ RFC: https://wiki.php.net/rfc/trailing_comma_in_parameter_list
465
467
466
468
- Date:
467
469
. Added DateTime::createFromInterface() and
Original file line number Diff line number Diff line change
1
+ --TEST--
2
+ Trailing comma in function signatures
3
+ --FILE--
4
+ <?php
5
+
6
+ function test (
7
+ $ there ,
8
+ $ are ,
9
+ $ many ,
10
+ $ params ,
11
+ ) {
12
+ echo "Foo \n" ;
13
+ }
14
+
15
+ class Test {
16
+ public function method (
17
+ $ there ,
18
+ $ are ,
19
+ $ many ,
20
+ $ params ,
21
+ ) {
22
+ echo "Foo \n" ;
23
+ }
24
+ }
25
+
26
+ $ func = function (
27
+ $ there ,
28
+ $ are ,
29
+ $ many ,
30
+ $ params ,
31
+ ) {
32
+ echo "Foo \n" ;
33
+ };
34
+
35
+ $ func = fn (
36
+ $ there ,
37
+ $ shouldnt ,
38
+ $ be ,
39
+ $ many ,
40
+ $ params ,
41
+ ) => print "Foo \n" ;
42
+
43
+ ?>
44
+ ===DONE===
45
+ --EXPECT--
46
+ ===DONE===
Original file line number Diff line number Diff line change @@ -633,7 +633,7 @@ alt_if_stmt:
633
633
;
634
634
635
635
parameter_list :
636
- non_empty_parameter_list { $$ = $1 ; }
636
+ non_empty_parameter_list possible_comma { $$ = $1 ; }
637
637
| %empty { $$ = zend_ast_create_list(0 , ZEND_AST_PARAM_LIST); }
638
638
;
639
639
You can’t perform that action at this time.
0 commit comments