amazon-pay-sdk-php icon indicating copy to clipboard operation
amazon-pay-sdk-php copied to clipboard

Fix Codestyle

Open mablae opened this issue 8 years ago • 11 comments

At least convert everything to leading spaces instead of these "tabs mixins" to start with.

mablae avatar Sep 19 '16 20:09 mablae

Fixed by #60

ejegg avatar Aug 10 '17 00:08 ejegg

This issue is actually pretty important if Amazon wants to benefit from community contributions.

Many of us use IDEs which reformat code to keep indentation consistent when we save a file, or when code is moved from one place to another. If we want to contribute code to this repository, we have to circumvent this behavior to preserve the inconsistent indentation, or our pull request will end up with a lot of irrelevant changes in the diff (making it more daunting to review).

ejegg avatar Aug 10 '17 00:08 ejegg

Fix Codestyle

Does this mean following http://www.php-fig.org/psr/psr-1/ and http://www.php-fig.org/psr/psr-2/?

This issue is actually pretty important if Amazon wants to benefit from community contributions.

Agree!

bmeynell avatar Aug 10 '17 14:08 bmeynell

Code style should be PSR-2 for libraries, correct?

mglaman avatar Aug 10 '17 16:08 mglaman

@mglaman - Yeah, and is actually a superset of PSR-1.

The style rules herein are derived from commonalities among the various member projects. When various authors collaborate across multiple projects, it helps to have one set of guidelines to be used among all those projects. Thus, the benefit of this guide is not in the rules themselves, but in the sharing of those rules.

bmeynell avatar Aug 10 '17 21:08 bmeynell

Ooh, I was just trying to make the code internally consistent without changing too much. I can make a new PR reformatting it to fit PSR-2.

ejegg avatar Aug 10 '17 21:08 ejegg

There's a patch available to fix this. @islandskater43 , if you want to merge #60 , I'll get started bringing my report downloading features over from my own fork.

ejegg avatar Sep 08 '17 13:09 ejegg

@ejegg - I've been using http://cs.sensiolabs.org/ recently to automate updating some older code to PSR-2. Take a look if you haven't already.

bmeynell avatar Sep 08 '17 13:09 bmeynell

@bmeynell, thanks for the suggestion! Do you find it better than phpcbf? I've used phpcbf for a few things, and found that it sometimes garbles comment text and omits newlines when inserting braces.

ejegg avatar Sep 08 '17 14:09 ejegg

Updated my reformat for 3.2.0 - now fixed by #63

ejegg avatar Dec 15 '17 15:12 ejegg

Hi @bjguillot , I've taken the 'elseif' clarifications out of my latest version of the PSR/2 fix so it should be easier to review. Is there any chance it could be merged this time?

ejegg avatar Jan 11 '18 23:01 ejegg