Open moufmouf opened 9 years ago
Hi @harikt ,
Thanks for the pointer. I have no previous experience with code style fixers. Do you know both? Any advice on which to choose or why I might want to take one CS fixer or the other?
Hi @moufmouf ,
I don't know or can write a comparison. Both are nice, and may be just try out to see how the diff looks on both.
The PHP_CodeSniffer have been there for quite some time, but they were not mainly looking to fix it. But it helps to point out the errors. I used it when I was working with Aura. Now PHP_CodeSniffer have also released the version to fix the code some time ago as stable.
Both are good, but my preference goes towards https://github.com/squizlabs/PHP_CodeSniffer for the existence in the php from the age of pear.
:+1: for your attitude on adopting a standard over your personal preferences for the good of your community. :) Of the many benefits of following a standard are the tools you will have at your disposal.
cs fixer is actually using PHP_CodeSniffer, and cs is actually fixing and not just give you a log of the errors. (yes cs can also just give you a log file)
As I work mostly on symfony projects I use cs like this
php php-cs-fixer.phar fix /path/to/project --level=symfony
Which I am adding to my deployment code, and it can be added to https://scrutinizer-ci.com/ also
And by the way, PHPStorm can also threat 4 spaces like a single tab, so its just like using tabs.
:+1: (was against those spaces too at first, but in the end it took like 3 days to get used to it)
I may not like spaces and prefer tabs, but still, there is a standard and it might be a good idea to follow it.
So here we go, we should think about running http://cs.sensiolabs.org/ on the code base.