RFC: https://wiki.php.net/rfc/trailing_comma_in_closure_use_list
Discussion: https://externals.io/message/110715
The release manager has agreed to allow merging of RFCs that have near-unanimous
votes. If an RFC ends up not achieving the required 2/3 majority at the time the
announced voting period closes, this implementation commit will be reverted
in time for the feature freeze.
Closes GH-5793
--- /dev/null
+--TEST--
+Closure use list can have trailing commas
+--FILE--
+<?php
+
+$b = 'test';
+$fn = function () use (
+ $b,
+ &$a,
+) {
+ $a = $b;
+};
+$fn();
+echo "$a\n";
+?>
+--EXPECT--
+test
lexical_vars:
%empty { $$ = NULL; }
- | T_USE '(' lexical_var_list ')' { $$ = $3; }
+ | T_USE '(' lexical_var_list possible_comma ')' { $$ = $3; }
;
lexical_var_list: