Re: [RFC] Allow trailing comma in parameter lists
| From: | tyson andre | Date: | Fri, 27 Mar 2020 13:58:59 +0000 |
| Subject: | Re: [RFC] Allow trailing comma in parameter lists | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-109373@lists.php.net to get a copy of this message | ||
Hi internals,
I'd just like to add that https://wiki.php.net/rfc/trailing_comma_in_parameter_list
seems useful,
especially now that PSR-12 is approved and https://www.php-fig.org/psr/psr-12/#45-method-and-function-arguments
recommends that
"When the argument list is split across multiple lines, the closing parenthesis and opening
brace MUST be placed together on their own line with one space between them."
(Previously, I don't think there was any attempt at standardizing a recommendation of where the
closing parenthesis should go)
```
class ClassName
{
public function aVeryLongMethodName(
ClassTypeHint $arg1,
&$arg2,
array $arg3 = [] // comma would be useful here when adding or removing in diffs
) {
// method body
}
}
```
- Tyson