Skip to content

allowed trailing comma for function parameter lists and closure use lists#308

Open
i582 wants to merge 2 commits intomasterfrom
pmakhnev/trailing_comma_for_function_args_and_uses
Open

allowed trailing comma for function parameter lists and closure use lists#308
i582 wants to merge 2 commits intomasterfrom
pmakhnev/trailing_comma_for_function_args_and_uses

Conversation

@i582
Copy link
Contributor

@i582 i582 commented Sep 11, 2021

RFC: https://wiki.php.net/rfc/trailing_comma_in_parameter_list
RFC: https://wiki.php.net/rfc/trailing_comma_in_closure_use_list

These two changes are very similar, therefore, they are combined into a single PR.

Function parameter list example:

function foo(
  $arg,
  $arg2, // allowed
) {
    echo $arg . $arg2 . "\n";
}

Closure use list example:

$foo = function () use (
    $a,
    $b, // allowed
) {
   echo $a, $b;
};

The GenTree::gen_list function is rather complicated, so a description has been added for it for all possible variants of its use.

#290

…ists

1. function foo(
     $arg,
     $arg2, // allowed
   ) { ... }

2. $foo = function () use (
       $a,
       $b, // allowed
   ) { ... };
@i582 i582 added the PHP8 PHP8 feature label Sep 11, 2021
@Tsygankov-Slava Tsygankov-Slava mentioned this pull request Jul 3, 2023
44 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

PHP8 PHP8 feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant