-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PHP 8.1 - Constructor Multi-line function declaration not indented correctly #3786
Comments
This sounds similar to #3631. Please can you run |
State 1:
State 2:
|
Based on the above, this is due to the PHP 8.1 "new in initializers" syntax not yet being taken into account by the @fredden Are you already working on a fix or shall I have a look ? |
You're welcome to pick this up. I probably won't have capacity to look into this for at least a few days. |
PR #3787 should fix this. Testing appreciated. |
@jrfnl Thanks for creating the PR. Tested it locally and it works! |
@ricklambrechts Thanks for testing and confirming! |
FYI: the fix for this issue is included in today's PHP_CodeSniffer 3.8.0 release. As per #3932, development on PHP_CodeSniffer will continue in the PHPCSStandards/PHP_CodeSniffer repository. If you want to stay informed, you may want to start "watching" that repo (or watching releases from that repo). |
Describe the bug
Line indenting should be correct but is not correct for PHPCS. PHPCS says that PHPCBF can fix it:
23 | ERROR | [x] Multi-line function declaration not indented correctly; expected 8 spaces but found 12
24 | ERROR | [x] Multi-line function declaration not indented correctly; expected 8 spaces but found 12
25 | ERROR | [x] Multi-line function declaration not indented correctly; expected 8 spaces but found 12
But after fixing the indentating is 8 spaces and PHPCS says:
23 | ERROR | [x] Multi-line function call not indented correctly; expected 12 spaces but found 8
24 | ERROR | [x] Multi-line function call not indented correctly; expected 12 spaces but found 8
25 | ERROR | [x] Multi-line function call not indented correctly; expected 12 spaces but found 8
Code sample
Custom ruleset
To reproduce
Steps to reproduce the behavior:
test.php
with the code sample above...phpcs test.php ...
Expected behavior
The expected behaviour would be that the indentation of 12 spaces is correct.
Versions (please complete the following information):
The text was updated successfully, but these errors were encountered: