My js(x),ts(x),(s)css are using 2 space indentation except PHP.
So just wanner talking about that :)
There is no "better" indentation style, it's a matter of personal preference, though most of the PHP world uses four spaces as indentation because it follows the PSR-2 Coding Standard Guide, which only allows using four spaces.
Note that PHP CS Fixer allows you to configure the indentation style you want.
I'm closing this issue as it's neither a feature request nor a bug report but that doesn't mean the discussion ends :)
Yes, most PHP projects are using 4 spaces indentation.
But why? PSR2 just wrote why use space not tab, no explain that why use 4 instead of 2 or not 3?
2.4. Indenting
Code MUST use an indent of 4 spaces, and MUST NOT use tabs for indenting.N.b.: Using only spaces, and not mixing spaces with tabs, helps to avoid
problems with diffs, patches, history, and annotations. The use of spaces
also makes it easy to insert fine-grained sub-indentation for inter-line
alignment.
why 4? simply for unification. to let whole ecosystem follow one pattern.
why 4 and not X, Y or Z? because most of the community voted for 4 spaces (https://www.php-fig.org/psr/psr-2/#a1-survey-data)
@keradus Oh, thank you. The survey is my anwser.
Most helpful comment
why 4? simply for unification. to let whole ecosystem follow one pattern.
why 4 and not X, Y or Z? because most of the community voted for 4 spaces (https://www.php-fig.org/psr/psr-2/#a1-survey-data)