====== WACT Coding Standards ======
The WACT project uses the [[http://pear.php.net/manual/en/standards.php|PEAR Coding standards]] with a few exceptions and additions.
===== PEAR Standard Exceptions =====
WACT makes the following exceptions to the PEAR coding standards.
==== Function Definitions ====
WACT uses the one true brace style for function definitions.
function HelloWorld() {
echo "Hello World!";
}
This overrides the [[http://pear.php.net/manual/en/standards.funcdef.php|Function Defintions]] section of the PEAR coding standard.
==== Header Comment Blocks ====
//Many Exceptions here.//
This overrides the [[http://pear.php.net/manual/en/standards.header.php|Header Comment Blocks]] section of the PEAR coding standard.
==== Naming Conventions ====
All classes and functions in WACT should be prefixed by 'Wact'.
class WactExample {
}
function WactExample() {
}
WACT code should not use constants defined with [[phpfn>define]]. Class constants should be all upper case.
WACT code should not use global variables. //Does it do that anyway now? If it does, we need to talk prefixes.//
This overrides the [[http://pear.php.net/manual/en/standards.naming.php|Naming Conventions]] section of the PEAR coding standard.
===== Additional Standards =====
==== Including Code ====
All includes in WACT must be relative to the ''include_path''.
A file should require_once its dependencies at the top of the file.
=== Lazy Loading for exceptions ===
All exception classes should be lazy loaded.
require_once 'wact/sample/example.xcpt.php';
throw new ExampleException();
See [[wact:file organization]] for more information on the ''.xcpt.php'' filename extension.