Version 39 by Gavin
on Jan 08, 2007 20:29.

compared with
Key
This line was removed.
This word was removed. This word was added.
This line was added.

Changes (2)

View Page History
Good coding standards are important in any development project, particularly when multiple developers are working on the same project. Having coding standards helps to ensure that the code is of high quality, has fewer bugs, and is easily maintained.

Abstract goals we strive for:
* extreme simplicity
* tool friendliness, such as use of method signatures, constants, and patterns that support IDE tools and auto-completion of method, class, and constant names.

When considering the goals above, each situation requires an examination of the circumstances and balancing of various trade-offs.

h1. PHP File Formatting

{code}

Where possible, try to keep your use of exceptions vs. type hinting consistent, and not mix both approaches at the same time in the same method for validating argument types. However, before PHP 5.2, "Failing to satisfy the type hint results in a fatal error," and might fail to satisfy other coding standards involving the use of throwing exceptions. Beginning with PHP 5.2, failing to satisfy the type hint results in an E_RECOVERABLE_ERROR, requiring developers to deal with these from within a custom error handler, instead of using a try..catch block.

h3. Function and Method Usage