Hi internals,
I've created a new RFC https://wiki.php.net/rfc/trailing_comma_in_closure_use_list to allow a trailing comma in closure use lists. This is already supported for argument and parameter lists.
$longArgs_longVars = function (
$longArgument,
$longerArgument,
$muchLongerArgument, // Trailing commas were allowed in parameter lists in PHP 8.0
) use (
$longVar1,
$longerVar2,
$muchLongerVar3 // The RFC proposes allowing a trailing comma here.
) {
// body
};
Earlier discussion can be found on https://externals.io/message/110715
(Permitting trailing commas in closure use() declarations)
I think if there are no objections on list, we can just land this change.
Given how positive the outcome of the "trailing comma in parameter lists"
RFC was this doesn't seem controversial.
This may potentially be more controversial than "trailing comma in parameter lists"
(an earlier vote was 16-22 for closure use vs 24-20 for parameters in https://wiki.php.net/rfc/list-syntax-trailing-commas).
It's worth considering just merging if there are no objections before voting on the RFC starts
(planned 14 days from now, on July 15th)
Thanks,
- Tyson