twitteroauth icon indicating copy to clipboard operation
twitteroauth copied to clipboard

Follow PSR-2 Guidelines

Open 0x46616c6b opened this issue 11 years ago • 11 comments

I would prefer to use the PSR-2 Guidelines for Code Styles. What do you think?

0x46616c6b avatar Jan 07 '15 11:01 0x46616c6b

I'm not liking this style:

Code MUST use 4 spaces for indenting, not tabs.

Nope, 2 spaces is much nicer to read

Opening braces for classes MUST go on the next line, and closing braces MUST go on the next line after the body.

Opening braces for methods MUST go on the next line, and closing braces MUST go on the next line after the body.

Not liking this as well, I prefer

function abc {
  ...
}

Just me 2 cents ;)

jelledelaender avatar Jan 07 '15 11:01 jelledelaender

I think the argumentation of personal dislike the visual style is not purposeful. My motivation came from integrating the lib in the Symfony Framework or some Web Application. All the main testing and linting tools following the PSR Guidlines. So I must not configure special code styles.

0x46616c6b avatar Jan 07 '15 11:01 0x46616c6b

I do plan on switching to 4 spaces. I haven't looked at the rest of PSR-2 yet though.

abraham avatar Jan 07 '15 15:01 abraham

+1

I agree with project following PSR-2.

hussani avatar Jan 07 '15 15:01 hussani

I would make a merge request for that, but not until your refactorings and api breaks are finished.

0x46616c6b avatar Jan 07 '15 18:01 0x46616c6b

Do you having linting tools that you like?

abraham avatar Jan 07 '15 19:01 abraham

I took an initial pass as improving compatibility in TwitterOAuth.php

abraham avatar Jan 08 '15 02:01 abraham

For the initial reformat of the code I would suggest PHP CS Fixer. When you use an IDE like PHPStorm you can simply configure your project to follow PSR-2 and reformat the code.

0x46616c6b avatar Jan 08 '15 08:01 0x46616c6b

+1

phillipsnick avatar Jan 08 '15 22:01 phillipsnick

OAuth.php has now been split by classes. other than some needed camelCase updates the codebase should be pretty PSR-2 compliant now.

abraham avatar Jan 09 '15 16:01 abraham

I'm considering PSR-2 compatibility done. Please open pull requests/issues for anything that was missed.

abraham avatar Jan 09 '15 19:01 abraham