thecodingmachine / mouf

The Mouf PHP framework: an open-source PHP framework providing an easy way to download, install, use and reuse components, with a graphical user interface.
MIT License
54 stars 28 forks source link

Adopt PSR-2 #84

Open moufmouf opened 9 years ago

moufmouf commented 9 years ago

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.

harikt commented 9 years ago

One more https://github.com/squizlabs/PHP_CodeSniffer

moufmouf commented 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?

harikt commented 9 years ago

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.

simensen commented 9 years ago

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

lsv commented 9 years ago

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

lsv commented 9 years ago

And by the way, PHPStorm can also threat 4 spaces like a single tab, so its just like using tabs.

mnapoli commented 9 years ago

:+1: (was against those spaces too at first, but in the end it took like 3 days to get used to it)