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

Review sniff handling of PHP 7.3 trailing comma in function calls #2040

Closed
dingo-d opened this issue Apr 22, 2022 · 1 comment
Closed

Review sniff handling of PHP 7.3 trailing comma in function calls #2040

dingo-d opened this issue Apr 22, 2022 · 1 comment

Comments

@dingo-d
Copy link
Member

dingo-d commented Apr 22, 2022

Since PHP 7.3, adding a trailing comma in function calls, like:

array_merge( $array_one, $array_two, $array_three, );

won't throw a parse error.

This has been motivated by the fact that you could have a trailing comma in an array declaration since always:

array(
  'hello',
  'world',
);

and in grouped namespace syntax since PHP 7.2:

use Foo\Bar\{
    Foo,
    Bar,
};

There are examples of what's not allowed in the RFC.

If I'm not mistaken, PEAR.Functions.FunctionCallSignature sniff should handle it, and we are including it in the WordPress-Core ruleset. Once we up the requirement of PHPCS to 3.7.0, we should just add extra test cases to see if it's handled correctly.

Refs:

Related to #764

@dingo-d dingo-d added this to the 3.0.0 milestone Apr 22, 2022
@jrfnl
Copy link
Member

jrfnl commented Jul 6, 2023

Closing as duplicate of #1363

@jrfnl jrfnl closed this as not planned Won't fix, can't repro, duplicate, stale Jul 6, 2023
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

2 participants