Closed
Description
This might be related to #2523.
Using the file:
<?php
declare(strict_types=1);
print_r(array_map(
fn(string $n): array => [1, bcadd($n, '3')],
['1', '2', '3']
));
Produces the error:
$ phpcs --standard=PSR12 -s ./test2.php
FILE: test2.php
-------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-------------------------------------------------------------------------------------------------
6 | ERROR | [x] Only one argument is allowed per line in a multi-line function call
| | (PSR2.Methods.FunctionCallSignature.MultipleArguments)
-------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------------------------------
Time: 54ms; Memory: 6MB
This seems specific to an arrow function that has an array
return type with a multiple argument function call in the body of the arrow function. Using fn(string $n): string => bcadd($n, '3')
or fn(string $n): array => [$n, 3]
as the arrow function produces no error from phpcs.