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

PSR-2 Cleanup #1173

Closed
wants to merge 13 commits into from
Closed

PSR-2 Cleanup #1173

wants to merge 13 commits into from

Conversation

peshi
Copy link
Contributor

@peshi peshi commented Jul 18, 2015

Small psr-2 cleanup

peshi added 13 commits July 18, 2015 18:13
The body of each structure MUST be enclosed by braces. Braces should be properly placed. Body of braces should be properly indented.
A file must always end with a single empty line feed.
When making a method or function call, there MUST NOT be a space between the method or function name and the opening parenthesis.
Spaces should be properly placed in a function declaration.
Code MUST use an indent of 4 spaces, and MUST NOT use tabs for indenting.
The PHP constants true, false, and null MUST be in lower case.
PHP keywords MUST be in lower case.
In method arguments and method call, there MUST NOT be a space before each comma and there MUST be one space after each comma.
There MUST be one use keyword per declaration.
There MUST NOT be a space after the opening parenthesis. There MUST NOT be a space before the closing parenthesis.
Each namespace use MUST go on its own line and there MUST be one blank line after the use statements block.
Remove trailing whitespace at the end of non-blank lines.
Visibility MUST be declared on all properties and methods; abstract and final MUST be declared before the visibility; static MUST be declared after the visibility.
@peshi
Copy link
Contributor Author

peshi commented Jul 18, 2015

If this is OK with you, i'll squash the commits.

@malarzm
Copy link
Member

malarzm commented Jul 18, 2015

We purposely add spaces before ! so hyperunknown@8fc2f0b won't be much use.

Anyway I'm not sure if this will be merged, there were previous attempts on running a CS Fixer but none of them was successful as the best would be enforcing standard organization wide.

By the way, is hyperunknown@5e3bbd6 really a PSR thing?

@peshi
Copy link
Contributor Author

peshi commented Jul 18, 2015

@malarzm
Any particular reason for using a space before ! ?
There's no mention of it in https://github.com/doctrine/coding-standard/tree/master/Docs

For your question, please refer to pt. 6. Closures
http://www.php-fig.org/psr/psr-2

Why where previous attempts using a cs fixer not successful ?
Let me know if you only want parts of it like eof_ending, trailing_spaces etc, or none of them.. then I'll close this PR.

@BernardoSilva
Copy link
Contributor

I would suggest merge this PR: #1097 first, this way every contributor follow same PSR-2 rules. :)

@malarzm
Copy link
Member

malarzm commented Jul 19, 2015

@peshi it's more readable :) Also I think @guilhermeblanco likes that very much and we believe it was ommited accidentally in the PSR. Heh for closures, PSR2 always surprises me...

As for previous attempts we ended up not merging them mainly because we'd like to roll CS rules for all Doctrine projects but usually this issue is not on top of anybody's todo list ;)

@peshi
Copy link
Contributor Author

peshi commented Jul 19, 2015

Alright, fair enough :)
In any case each commit represent the rule I used with php-cs-fixer from Sensiolabs.
It's probably better you guys choose your preferred rules to use in the future :)

Closing.

@peshi peshi closed this Jul 19, 2015
@jmikola
Copy link
Member

jmikola commented Jul 21, 2015

@peshi: thanks for investing the time on this. I did look into creating fixer rules, but never got around to customizing them enough to meet @guilhermeblanco's demands.

https://github.com/doctrine/coding-standard exists and will one day address this, but it's still a work in progress.

@peshi
Copy link
Contributor Author

peshi commented Jul 27, 2015

@jmikola No worries, I have been following the fixer commits that's why I decided to split each rule into it's own commit and only choosing a few. In any case I suspected that it might be rejected and in the process receive an explanation :)

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

4 participants