minkphp / phpunit-mink

Library for using Mink in PHPUnit tests. Supports session sharing between tests in a test case.
BSD 3-Clause "New" or "Revised" License
70 stars 20 forks source link

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

Open stof opened 9 years ago

stof commented 9 years ago

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:

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 commented 9 years ago

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