Starting with PHP 7.4 we'll have the ability to create arrow functions. The stable version will be available at the end of the year, but right now I'm testing the alpha2 release.
An arrow function with only one argument triggers a unwanted error Useless parentheses (SlevomatCodingStandard.PHP.UselessParentheses.UselessParentheses):
$firstName = 'John';
$name = fn($firstName) => 'FirstName: ' . $firstName;
Zero or two or more arguments does not trigger an error - as expected.
// arrow function without arguments
$fullName = fn() => 'John Doe';
// arrow function with two or more arguments
$firstName = 'John';
$lastName = 'Doe';
$fullName = fn($firstName, $lastName) => $firstName . $lastName;
Environment:
PHP 7.4.0alpha2 (cli) (built: Jul 12 2019 01:56:19)PHP_CodeSniffer version 3.4.2 (stable)5.0.4Not possible without https://github.com/squizlabs/PHP_CodeSniffer/issues/2523
looks that the phpcs issue is closed now
Fixed in master.
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.