[CCA Standards] Coding Style PSR-1 und PSR-2

Tristan Lins tristan.lins at bit3.de
Fr Mär 14 20:57:54 CET 2014


Hey,

ich habe von LF die Tage erfahren, dass Contao zukünftig auf PSR-1¹ /
PSR-2² wechseln wird.

[1] http://www.php-fig.org/psr/psr-1/
[2] http://www.php-fig.org/psr/psr-2/

Bevor wir jetzt anfangen einen neuen Code Style zu definieren, wäre ich
dafür die Diskussion um PSR-1/2 noch mal auf zu nehmen.

Dabei möchte ich vor allem den Gedanken der Interoperabilität hervor
heben, da ich weiß dass einige strikt gegen SPACE Indention sind. Imo
ist die Frage ob TAB oder SPACE Indention verwendet wird heute
vorwiegend eine Glaubensfrage.

> 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.
- 2.4. Indenting - http://www.php-fig.org/psr/psr-2/

Auch weitere Argumente, wie bspw. der Overhead (1 Tab := 1 Byte -> 4
Spaces := 4 Bytes) treffen meines Erachtens nicht mehr so zu. PHP
Interessiert das nicht und CSS/JS/HTML lässt sich minifien.

Mit einer guten IDEs sind SPACEs dank Smart-TABs auch kein Problem mehr:

~/.vimrc

> set smartindent
> set tabstop=4
> set shiftwidth=4
> set expandtab

;-)


Jetzt möchte ich gerne eure Meinungen dazu hören, aber bitte nicht "TABs
sind zum Einrücken da" oder so was ähnliches. Den Glaubenskrieg TABs vs.
SPACEs müssen wir hier imo nicht führen.

MfG Tristan

-- 
Tristan Lins - Inhaber, Softwareentwickler
bit3 UG (haftungsbeschränkt)
Im Coenen Palais · Hofstr. 272 · 56077 Koblenz
info at bit3.de · http://bit3.de · 0261-45093253
Amtsgericht Koblenz, HRB 23386


More information about the Standards mailing list