General

  • Simple is better than complex (see "The Zen of Python")
  • Use phpdoc syntax for every function you add.
  • Limit lines to 78 characters
  • Use the identical operator whenever possible (faster).
  • Do not use magic numbers! If you spot any in the core, remove them or file a bug report!

Indentation

  • Use the 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);
}
driven/style_guide.txt · Last modified: 2008/08/12 21:44 by skavez

Home Page | User Forums | Driven by DokuWiki
Copyright © 2008 xPattern