Language and development rules: Difference between revisions

Jump to navigation Jump to search
m
Line 64: Line 64:
</source>
</source>


* Functions must return a value strictly higher than 0 if successful and strictly lower than 0 if error.
* Functions must return a value equal or higher than 0 if successful and strictly lower than 0 if error.


* No dead code (code never used) into Dolibarr core code (code used by external modules only must be included within the external modules).
* No dead code (code never used) into Dolibarr core code (code used by external modules only must be included within the external modules).


* Use "include_once" for anything with functions or class definitions in it (like *.class.php and *.lib.php files), use "include" for template-style php with files containing a mix of HTML and PHP (like *.inc.php and *.tpl.php files).
* Use "include_once" for anything with functions or class definitions in it (like *.class.php and *.lib.php files), use "include" for template-style php with files containing common part of HTML and PHP code (like *.inc.php and *.tpl.php files).


* 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:
* 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:

Navigation menu