31,003
edits
m (→PHP) |
m (→PHP) |
||
| Line 71: | Line 71: | ||
* Coding style to use is the PSR-2 (https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md). There is however exceptions: | * Coding style to use is the PSR-2 (https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md). There is however exceptions: | ||
** Length of line: We accept more than 80 characters per line. 80 | ** Length of line: We accept more than 80 characters per line and even more than 120. 80 was a maximul length introduced with fist computers when screen was text only and is nowday very low. In most cases, we don't go over 80 characters, but sometimes (when declaring a list of reference arrays, like in the module descriptor files), 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. PSR-2 mention we can go up to 120, but currently we can go up to 1000 (we may reduce this in future). | ||
** The other exception is that we don't replace the | ** The other exception is that we don't replace 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). | ||
** The following rule is also added: | ** The following rule is also added: | ||
*** Files must be saved with Unix format (LF) and not Windows (CR/LF). Unix format is compatible on all OS such as Unix like, Windows, Mac, but the Windows text file format may not work on some PHP under Unix. | *** Files must be saved with Unix format (LF) and not Windows (CR/LF). Unix format is compatible on all OS such as Unix like, Windows, Mac, but the Windows text file format may not work on some PHP under Unix. | ||