# [RFC] Allow trailing comma in closure use list

- Thread: https://externals.io/message/110804
- Original archive: https://news-web.php.net/php.internals/110804
- Started by tyson andre on 2020-07-01T17:52:02+00:00
- Messages: 1
- RFC: Allow trailing comma in closure use lists (Implemented (PHP 8.0)) — https://externals.io/rfc/trailing_comma_in_closure_use_list.md
- RFC: Trailing commas in list syntax (Implemented (PHP 7.2)) — https://externals.io/rfc/list-syntax-trailing-commas.md
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · RFCs at https://externals.io/rfc.md · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #110804 — tyson andre — 2020-07-01T17:52:02+00:00

URL: https://externals.io/message/110804#110804

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
