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

Generic/FunctionCallArgumentSpacing: prevent fixer conflict over PHP 7.3+ trailing comma's in function calls #3805

Conversation

jrfnl
Copy link
Contributor

@jrfnl jrfnl commented Apr 19, 2023

Reported via Mastodon by @WyriHaximus: https://phpc.social/@wyri@haxim.us/110224066521542315

As of PHP 7.3, trailing comma's in function calls are allowed.

This sniff should leave those alone to prevent fixer conflicts with sniffs dealing with the spacing around the parentheses of a function call, like the PEAR.Functions.FunctionCallSignature sniff, which this sniff is often combined with.

While the sniff did take trailing comma's into account for multi-line function calls, it did not handle them correctly for single-line function calls.

Note: too much space can still be removed, but space should not be added.

Fixed now.

Includes tests.

…7.3+ trailing comma's in function calls

As of PHP 7.3, trailing comma's in function calls are allowed.

This sniff should leave those alone to prevent fixer conflicts with sniffs dealing with the spacing around the parentheses of a function call, like the `PEAR.Functions.FunctionCallSignature` sniff, which this sniff is often combined with.

While the sniff did take trailing comma's into account for multi-line function calls, it did not handle them correctly for single-line function calls.

Note: too _much_ space can still be removed, but space should be added.

Fixed now.

Includes tests.
@gsherwood gsherwood added this to the 3.8.0 milestone May 4, 2023
gsherwood added a commit that referenced this pull request May 4, 2023
@gsherwood gsherwood closed this May 4, 2023
@jrfnl jrfnl deleted the feature/generic-functioncallargumentspacing-fix-fixer-conflict-with-php73-trailing-commas branch May 4, 2023 07:56
@jrfnl
Copy link
Contributor Author

jrfnl commented May 4, 2023

Merged manually.

@jrfnl
Copy link
Contributor Author

jrfnl commented Dec 8, 2023

FYI: this fix is included in today's PHP_CodeSniffer 3.8.0 release.

As per #3932, development on PHP_CodeSniffer will continue in the PHPCSStandards/PHP_CodeSniffer repository. If you want to stay informed, you may want to start "watching" that repo (or watching releases from that repo).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants