rfc:trailing_comma_in_closure_use_list

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Last revisionBoth sides next revision
rfc:trailing_comma_in_closure_use_list [2020/07/01 17:40] tandrerfc:trailing_comma_in_closure_use_list [2020/07/15 13:38] tandre
Line 1: Line 1:
-====== PHP RFC: Allow trailing comma in closure use list ====== +====== PHP RFC: Allow trailing comma in closure use lists ====== 
-  * Version: 0.1+  * Version: 0.2
   * Date: 2020-07-01   * Date: 2020-07-01
   * Author: Tyson Andre <tandre@php.net>   * Author: Tyson Andre <tandre@php.net>
-  * Status: Under Discussion+  * Status: Voting
   * Target Version: PHP 8.0   * Target Version: PHP 8.0
-  * Implementation: https://github.com/php/php-src/pull/5306+  * Implementation: https://github.com/php/php-src/pull/5793
  
 ===== Introduction ===== ===== Introduction =====
Line 25: Line 25:
    // body    // body
 }; };
 +$longArgs_longVars(
 +    $longArgumentValue,
 +    $obj->longMethodCall(),
 +    $obj->longPropertyName ?? $longDefault,
 +);
 </PHP> </PHP>
  
-This constructor has too many parameters and closure use variables to place all of them on one line, at least under conventional coding standards. In such cases [[https://www.php-fig.org/psr/psr-12/#7-closures|PSR-12]] recommends using the formatting above instead (PSR-12 predates support for trailing commas in parameter lists).+This closure declaration has too many parameters and closure use variables to place all of them on one line, at least under conventional coding standards. In such cases [[https://www.php-fig.org/psr/psr-12/#7-closures|PSR-12]] recommends using the formatting above instead (PSR-12 predates support for trailing commas in parameter lists).
  
 Unfortunately, it is currently not possible to place a trailing comma in the closure use list. This breaks uniformity, and results in larger diffs when a new optional closure use variable is added. Additionally, it is inconsistent with parameter lists and call-sites, which **do** allow a trailing comma. Unfortunately, it is currently not possible to place a trailing comma in the closure use list. This breaks uniformity, and results in larger diffs when a new optional closure use variable is added. Additionally, it is inconsistent with parameter lists and call-sites, which **do** allow a trailing comma.
Line 53: Line 58:
 ===== Vote ===== ===== Vote =====
  
-Yes/No, requiring 2/3 majority+Yes/No, requiring 2/3 majority.
  
 +Voting starts 2020-07-15 and ends 2020-07-29.
  
 +<doodle title="Allow trailing comma in closure use lists" auth="tandre" voteType="single" closed="false">
 +   * Yes
 +   * No
 +</doodle>
 +
 +===== Changelog =====
 +
 +0.2: Fix implementation link.
 +
 +===== Discussion ======
 +
 +https://externals.io/message/110715 "Permitting trailing commas in closure use() declarations"
 +
 +https://externals.io/message/110804 "[RFC] Allow trailing comma in closure use list"
rfc/trailing_comma_in_closure_use_list.txt · Last modified: 2020/07/29 18:33 by tandre