16
edits
No edit summary Tag: 2017 source edit |
(Übersetzung) |
||
| Line 98: | Line 98: | ||
</source> | </source> | ||
*Funktionen müssen bei Erfolg einen Wert zurückgeben, der größer/gleich 0 ist und bei Fehlern zwingend kleiner als 0 ist | |||
* | *Es darf kein Code im Dolibarr-Kerncode vorhanden sein, welcher nur von Externen Modulen verwendet wird (Toter Code). Code von externen Modulen muss in den externen Modulen enthalten sein. | ||
* | *Verwenden Sie "include_once" für alles, was Funktionen oder Klassendefinitionen enthält (wie * .class.php- und * .lib.php-Dateien), und "include" für PHP-Dateien im Vorlagenstil, die HTML- und PHP-Code enthalten (wie * .inc.php und * .tpl.php Dateien). | ||
* | *Der zu verwendende Codierungsstil ist '''PSR-12''' (https://www.php-fig.org/psr/psr-12/). Nur die Regeln, welche mit "Muss" gekennzeichnet sind, sind absolut zwingend. Beachten Sie die folgenden Ausnahmen: | ||
**Length of line: PSR-12 mention we can't go up to 120 characters on same line, this is a soft limit. It is better to have long lines instead of long page with code content that is just data declaration and does not contain any logic. However, we introduced a hard limit of '''1000''' characters (having line larger than this may return errors on Continuous Integration tests). | **Length of line: PSR-12 mention we can't go up to 120 characters on same line, this is a soft limit. It is better to have long lines instead of long page with code content that is just data declaration and does not contain any logic. However, we introduced a hard limit of '''1000''' characters (having line larger than this may return errors on Continuous Integration tests). | ||
**Tabs are allowed: The other exception is that we don't replace systematically the tabs with spaces. Using tabs is more convenient for most editors/developers. Also using spaces breaks some auto-format features (like Eclipse autoformat feature on some Eclipse version). For the moment, the best setup is "Keep spaces/tabs as it is", however, you can activate the option "Remove spaces at end of lines". | **Tabs are allowed: The other exception is that we don't replace systematically the tabs with spaces. Using tabs is more convenient for most editors/developers. Also using spaces breaks some auto-format features (like Eclipse autoformat feature on some Eclipse version). For the moment, the best setup is "Keep spaces/tabs as it is", however, you can activate the option "Remove spaces at end of lines". | ||
edits