Trailing Commas in Function and Method calls
When defining arrays in PHP, for quite some time, trailing commas were allowed. The following code example is legal PHP syntax:
$array = [1, 2,];
While trailing commas may look awkward at fist glance, it can make copying and pasting and reordering multiple arguments a lot easier:
$array = [
[1, 2, 3],
[7, 8, 9],
[4, 5, 6],
];
Since PHP 7.3, trailing commas are also allowed in method calls:
foo(1, 2);
foo(1, 2,);
function foo($a, $b)
{
}
While this change may seem minor, it can actually simplify code generators quite a bit.