Skip to content
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

Closed
wants to merge 4 commits into from

Conversation

MacDada
Copy link
Contributor

@MacDada MacDada commented May 16, 2014

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.json changed, I can remove it from the commit.

There are 2 errors that cannot be fixed simply:

}ix',
$contents,
$matches
);
Copy link
Contributor

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)

Copy link
Contributor Author

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)
--------------------------------------------------------------------------------

Copy link
Contributor

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.

Copy link
Contributor Author

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

@Seldaek
Copy link
Member

Seldaek commented May 24, 2014

Thanks but no thanks. I have no love for angry CS tools.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants