Language and development rules: Difference between revisions

Jump to navigation Jump to search
m
Line 73: Line 73:
** Length of line: PSR-2 mention we can 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 that this will return errors on Continuous Integration tests).  
** Length of line: PSR-2 mention we can 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 that this will return errors on Continuous Integration tests).  
** Tabs are allowed: 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).
** Tabs are allowed: 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:
** Note 1: The following rule are very important to follow:
*** 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.
*** Smart tags PHP are not used. PHP code section must start with '''<?php'''
*** Smart tags PHP are not used. PHP code section must start with '''<?php'''
** You can use the file dev/codesniffer/ruleset.xml as rule file to control coding style with PHPCodeSniffer.
** Note 2: You can use the file dev/codesniffer/ruleset.xml as rule file to control coding style with PHPCodeSniffer.
** You may note that current code is not yet compliant with this rule. The reason is that we must "now" follow the PSR-2, but it wasn't in the past. So feel free to change coding style to match new rules if you find such cases.
** Note 3: You may note that current code is not yet compliant with this rule. The reason is that we must "now" follow the PSR-2, but it wasn't in the past. So feel free to change coding style to match new rules if you find such cases.


== Classes and properties structures ==
== Classes and properties structures ==

Navigation menu