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

[Suggestion] Use coding standards consistent with other Mink libraries #32

Open
stof opened this issue Jan 17, 2015 · 1 comment
Open

Comments

@stof
Copy link
Member

stof commented Jan 17, 2015

The other Mink libraries are using the Symfony2 coding standards, which are a superset of PSR-2.
The current coding standards are conflicting with PSR-2, making it harder for new contributors to get them right (and forcing more experienced contributors to reconfigure their IDEs when switching to this project).
I identified 2 main violations of PSR-2 in the current coding standards:

  • tabs instead of spaces for the indentation
  • snake cased variable names instead of camel cased ones.
  • leading underscores in private properties (not sure whether PSR-2 defines it, but the Symfony standard used by Mink does)

I haven't reviewed everything in depth to build an exhaustive list though.

Note that a nice thing when using the PSR-2 coding standard is that the PHP-CS-Fixer can be used to fix many violations automatically (instead of just complaining in PHPCS). this is how I ensure the consistent coding standards on other Mink repos (the PHP-CS-Fixer also handles many Symfony-specific rules on top of PSR-2 btw).

@aik099
Copy link
Member

aik099 commented Jan 17, 2015

... and forcing more experienced contributors to reconfigure their IDEs when switching to this project

Is it that bad? IDEs are pretty clever these days. Recently I've also started to commit the .idea folder (used by PhpStorm) with the project so PhpStorm users would already have IDE preconfigured as needed with all needed PHP_CodeSniffer integration. And when auto-fixer comes into play then people can write what they want and auto-fixer would deal with standard differences.

Note that a nice thing when using the PSR-2 coding standard is that the PHP-CS-Fixer can be used to fix many violations automatically (instead of just complaining in PHPCS).

This is no longer the issue since PHP_CodeSniffer 2.0 release (made in December 2014), which allows to auto-fix issues (using tokenizer) as well.

... (the PHP-CS-Fixer also handles many Symfony-specific rules on top of PSR-2 btw).

Everybody has some extra standard checks these days on top of PSR-2 ones, so do I. I bet there are some sniffs for PHP_CodeSniffer for Symfony-specific stuff validation/fixing as well.

I'm not using PHP-CS-Fixer myself due missing IDE integration because switching from IDE to Terminal and back just to validate code several times doesn't speed up development. I've configured my IDE to report/fix custom stuff for me.

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

No branches or pull requests

2 participants