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
{{ message }}
Repository navigation
Wrong indentation false positive with arrow function after array in function call #968
Create a file called test.php with the code sample above
Run phpcs test.php --standard=PSR12
See error message displayed
FILE: /path/to/test.php
-----------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-----------------------------------------------------------------------------------
17 | ERROR | [x] Line indented incorrectly; expected at least 16 spaces, found 12
-----------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-----------------------------------------------------------------------------------
Expected behavior
No errors/warnings
Versions (please complete the following information)
Operating System
any (tried with MacOS 15.3.2)
PHP version
any recent one (tried with 8.3.19)
PHP_CodeSniffer version
3.12.2, master
Standard
PSR12
Install type
Composer
Please confirm
I have searched the issue list and am not opening a duplicate issue.
@InvisibleSmiley Thanks for reporting this. The issue is reproducible and needs further investigation to see what's happening with this in the Generic.WhiteSpace.ScopeIndent sniff to find a fix.
I can also confirm that the arrow function handling is most likely the problem, as changing the arrow function to a closure fixes the issue.
Activity
jrfnl commentedon Apr 22, 2025
@InvisibleSmiley Thanks for reporting this. The issue is reproducible and needs further investigation to see what's happening with this in the
Generic.WhiteSpace.ScopeIndentsniff to find a fix.I can also confirm that the arrow function handling is most likely the problem, as changing the arrow function to a closure fixes the issue.
Generic/ScopeIndent: fix wrong indentation with arrow function