Changes

Jump to navigation Jump to search
m
Reverted edits by Cbenke (talk) to last revision by Eldy
Line 69: Line 69:  
* Use "include_once" for anything with functions or class definitions in it (so *.class.php and *.lib.php files), use "include" for template-style php with files containing a mix of HTML and PHP (so *.inc.php and *.tpl.php files).
 
* Use "include_once" for anything with functions or class definitions in it (so *.class.php and *.lib.php files), use "include" for template-style php with files containing a mix of HTML and PHP (so *.inc.php and *.tpl.php files).
   −
* Coding style to use is based on Travis CI : during pull request Travis CI verify rules of coding, if travis say OK : the coding rule is OK
+
* Coding style to use is the PSR-2 (https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md) with 2 exceptions, this means:
 +
** Files must be saved with Unix format (LF) and not Windows (CR/LF). Unif format is compatible on all OS like Unix like, Windows, Mac, but the Windows text file format is no working on some PHP under Unix.
 +
** Smart tags PHP are not used. PHP code section must start with '''<?php'''
 +
** But there is an exception of length of line: We accept more than 80 characters per line. 80 is really to low. In most cases, we never go over 80, but sometimes (when declaring a list of reference arrays, like into 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 contains any logic.
 +
** The other exception is that we don't replace the tab with space. This makes lot of editor crazy and breaks some auto-format features.
 +
You can use the file dev/codesniffer/ruleset.xml as rule file to control coding style with PHPCodeSniffer.
    
= SQL rules =
 
= SQL rules =
Bureaucrats, emailconfirmed, Administrators
149

edits

Navigation menu