Allow trailing comma

This commit is contained in:
Andrea Faulds 2016-01-17 01:09:36 +00:00
parent f4c8b2cb30
commit 14bfe93ddc
2 changed files with 39 additions and 1 deletions

View file

@ -0,0 +1,38 @@
--TEST--
list() with keys and a trailing comma
--FILE--
<?php
$antonyms = [
"good" => "bad",
"happy" => "sad",
];
list(
"good" => $good,
"happy" => $happy
) = $antonyms;
var_dump($good, $happy);
echo PHP_EOL;
$antonyms = [
"good" => "bad",
"happy" => "sad",
];
list(
"good" => $good,
"happy" => $happy,
) = $antonyms;
var_dump($good, $happy);
?>
--EXPECT--
string(3) "bad"
string(3) "sad"
string(3) "bad"
string(3) "sad"

View file

@ -1174,7 +1174,7 @@ property_name:
assignment_list:
unkeyed_assignment_list
{ $$ = $1; }
| keyed_assignment_list
| keyed_assignment_list possible_comma
{ $$ = $1; }
;