PHPCSExtra icon indicating copy to clipboard operation
PHPCSExtra copied to clipboard

:sparkles: New `Universal.WhiteSpace.FirstClassCallableSpacing` sniff

Open jrfnl opened this issue 3 months ago • 0 comments

This sniff checks the whitespace around the ellipsis in a first class callable and can be used to address the following rule from PER-CS:

4.8 Function Callable References A function or method may be referenced in a way that creates a closure out of it, by providing ... in place of arguments.

If so, the ... MUST NOT include any whitespace before or after. That is, the correct format is foo(...).

Ref: https://www.php-fig.org/per/coding-style/#48-function-callable-references

The desired "spacing" before/after the ellipsis is configurable and defaults to "no space".

Includes fixer. Includes unit tests. Includes documentation.

jrfnl avatar Sep 21 '25 00:09 jrfnl