You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
When arrow function is used together with argument passed as reference (&), phpcs display this error "Expected 1 space after "&" operator; 0 found", which is wrong. if space is incorectly (but as suggested) added then phpcs display this error "Expected 0 spaces after reference operator for argument "$stdClass"; 1 found". phpcbf will simply fail on this. If function is written in old fashion way, everything works correctly.
Code sample
// correct (not considering other sniffs)var_dump(...array_map(function (?stdClass &$stdClass) {return1;}, []));
// Expected 1 space after "&" operator; 0 foundvar_dump(...array_map(fn (?stdClass &$stdClass) => 1, []));
// 0 spaces after reference operator for argument "$stdClass"; 1 foundvar_dump(...array_map(fn (?stdClass & $stdClass) => 1, []));
Custom ruleset
None.
To reproduce
Steps to reproduce the behavior:
Create a file called test.php with the code sample above...
Run phpcs test.php ...
See error message displayed
3 | ERROR | [x] Expected 1 space after "&" operator; 0 found
3 | ERROR | [x] Expected 0 spaces after reference operator for argument "$stdClass"; 1 found
Expected behavior
There should be no error displayed with arrow function and zero space between & and paramerer name
Versions (please complete the following information):
OS: Ubuntu 20.04 LTS
PHP: PHP 7.4.7
PHPCS: 3.5.5, master
Additional context
None.
The text was updated successfully, but these errors were encountered:
Describe the bug
When arrow function is used together with argument passed as reference (&), phpcs display this error "Expected 1 space after "&" operator; 0 found", which is wrong. if space is incorectly (but as suggested) added then phpcs display this error "Expected 0 spaces after reference operator for argument "$stdClass"; 1 found". phpcbf will simply fail on this. If function is written in old fashion way, everything works correctly.
Code sample
Custom ruleset
None.
To reproduce
Steps to reproduce the behavior:
test.php
with the code sample above...phpcs test.php ...
Expected behavior
There should be no error displayed with arrow function and zero space between & and paramerer name
Versions (please complete the following information):
Additional context
None.
The text was updated successfully, but these errors were encountered: