Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PHP 7.3] Add trailing comma in multi-line function call #4135

Closed
ntzm opened this issue Dec 6, 2018 · 2 comments
Closed

[PHP 7.3] Add trailing comma in multi-line function call #4135

ntzm opened this issue Dec 6, 2018 · 2 comments

Comments

@ntzm
Copy link
Contributor

ntzm commented Dec 6, 2018

 foo(
     1,
-    2
+    2,
)

Only for PHP 7.3+

@SpacePossum SpacePossum changed the title [Feature request] Add trailing comma in multi-line function call [PHP 7.3] Add trailing comma in multi-line function call Dec 6, 2018
@kunicmarko20
Copy link

Any idea how to detect a function call? in isCandidate method I am getting:

[2]=>
  object(PhpCsFixer\Tokenizer\Token)#34 (4) {
    ["content":"PhpCsFixer\Tokenizer\Token":private]=>
    string(3) "foo"
    ["id":"PhpCsFixer\Tokenizer\Token":private]=>
    int(319)
    ["isArray":"PhpCsFixer\Tokenizer\Token":private]=>
    bool(true)
    ["changed":"PhpCsFixer\Tokenizer\Token":private]=>
    bool(false)
  }
  [3]=>
  object(PhpCsFixer\Tokenizer\Token)#33 (4) {
    ["content":"PhpCsFixer\Tokenizer\Token":private]=>
    string(1) "("
    ["id":"PhpCsFixer\Tokenizer\Token":private]=>
    NULL
    ["isArray":"PhpCsFixer\Tokenizer\Token":private]=>
    bool(false)
    ["changed":"PhpCsFixer\Tokenizer\Token":private]=>
    bool(false)
  }

T_STRING followed by ( , not sure this is reliable to detect a function call?

@kubawerlos
Copy link
Contributor

It's not that simple -> #4238

keradus added a commit that referenced this issue May 3, 2021
This PR was squashed before being merged into the 2.19-dev branch.

Discussion
----------

TrailingCommaInMultilineFixer - introduction

Resolves #4135

Commits
-------

5b36241 TrailingCommaInMultilineFixer - introduction
@keradus keradus closed this as completed May 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants