===== General ===== * Simple is better than complex (see [[http://www.python.org/dev/peps/pep-0020/|"The Zen of Python"]]) * Use [[http://www.phpdoc.org/|phpdoc syntax]] for every function you add. * Limit lines to 78 characters * Use the identical operator whenever possible (faster). * Do not use [[http://en.wikipedia.org/wiki/Magic_number_%28programming%29#Unnamed_numerical_constant|magic numbers]]! If you spot any in the core, remove them or file a bug report! ===== Indentation ===== * Use the [[http://en.wikipedia.org/wiki/Indent_style#Allman_style_.28bsd_in_Emacs.29|Allman style]] * Use tabs for indentation * Do not indent functions with one tab (indent methods with one tab). * Do not align assignment operators for multiple lines. ===== Example function ===== /** * Function description. * * @param string $foo A variable. * @return string */ function fooBar($foo) { if ($foo === 'bar') { $out[] = $foo; } else { $out[] = 'baz'; } return implode('', $out); }