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
PHPCS: code style errors detection and fixes #2993
Conversation
…eliminate copy-pasting
| }ix', | ||
| $contents, | ||
| $matches | ||
| ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The previous code was fine according to PSR-2. The function call was single-line (even though there was a multiline string in one of the arguments)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then it might be a phpcs bug, but if we are to encourage people to use it, I would have the line changed anyway – so that phpcs doesn't report any errors anymore and contributors have a clear view.
The report:
FILE: composer/src/Composer/Autoload/ClassMapGenerator.php
--------------------------------------------------------------------------------
FOUND 5 ERROR(S) AFFECTING 3 LINE(S)
--------------------------------------------------------------------------------
147 | ERROR | Opening parenthesis of a multi-line function call must be the
| | last content on the line
| | (PSR2.Methods.FunctionCallSignature.ContentAfterOpenBracket)
152 | ERROR | Only one argument is allowed per line in a multi-line function
| | call (PSR2.Methods.FunctionCallSignature.MultipleArguments)
152 | ERROR | Only one argument is allowed per line in a multi-line function
| | call (PSR2.Methods.FunctionCallSignature.MultipleArguments)
152 | ERROR | Closing parenthesis of a multi-line function call must be on a
| | line by itself
| | (PSR2.Methods.FunctionCallSignature.CloseBracketLine)
164 | ERROR | Line indented incorrectly; expected at least 20 spaces, found 18
| | (Generic.WhiteSpace.ScopeIndent.Incorrect)
--------------------------------------------------------------------------------
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is the same PHPCS bug than the other one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one should get fixed in the near future:
Fixed:
squizlabs/PHP_CodeSniffer#211
|
Thanks but no thanks. I have no love for angry CS tools. |
Contributing section mentions that the code should follow Symfony coding standards.
I added PHP_CodeSniffer as a dev requirement and applied fixes to detected errors.
If you don't want
composer.jsonchanged, I can remove it from the commit.There are 2 errors that cannot be fixed simply:
under_scorestyle. Because it'spublicby default, chaning that might be a BC break.