OC Coding Style: Unterschied zwischen den Versionen
Zur Navigation springen
Zur Suche springen
(Link zum Forum aktualisiert) |
(started new style guide) |
||
Zeile 1: | Zeile 1: | ||
The following rules apply to all developers who contribute source code to the Opencaching.de project. | |||
== | == General rules == | ||
All source code files must | |||
* not contain TAB characters, | |||
* use 4-char indenting columns, | |||
* be UTF-8 encoded without byte order marks, | |||
* use only LF as line ends, with the current exception of [[Entwicklung/Codedoku#Email-Templates|email templates]], which have RFC-822 CR/LF line ends. | |||
There are some tools in the [https://github.com/OpencachingDeutschland/oc-server3/tree/master/local/devel local/devel] directory for verifying and fixing these things. | |||
== | == PHP == | ||
All self-written or directly changed code must fully comply to the [http://www.php-fig.org/psr/psr-1/ PSR-1] / [http://www.php-fig.org/psr/psr-2/ PSR-2] standard, with these exceptions: | |||
* When referencing identifiers (e.g. class and function names) that are defined in non-PSR-2-compliant source code files, they need not be PSR-2 compliant. | |||
* When writing small standalone scripts like those in the 'local' and 'util' directories, they need not to comply to the PSR-1 "Side Effects" rule. | |||
Only <code><?php</code> and <code><?=</code> open tags must be used. <code><?</code> (short open tags) must not be used. | |||
< | |||
</ | |||
Version vom 19. Mai 2016, 15:46 Uhr
The following rules apply to all developers who contribute source code to the Opencaching.de project.
General rules
All source code files must
- not contain TAB characters,
- use 4-char indenting columns,
- be UTF-8 encoded without byte order marks,
- use only LF as line ends, with the current exception of email templates, which have RFC-822 CR/LF line ends.
There are some tools in the local/devel directory for verifying and fixing these things.
PHP
All self-written or directly changed code must fully comply to the PSR-1 / PSR-2 standard, with these exceptions:
- When referencing identifiers (e.g. class and function names) that are defined in non-PSR-2-compliant source code files, they need not be PSR-2 compliant.
- When writing small standalone scripts like those in the 'local' and 'util' directories, they need not to comply to the PSR-1 "Side Effects" rule.
Only <?php
and <?=
open tags must be used. <?
(short open tags) must not be used.