Based on the polls issued this week, we're going to make the following addendums to our coding standards:
PHP 5.3 introduces namespaces. Part of namespace support is the ability to alias namespaces and/or members of namespaces with the "use" annotation.
When aliasing within ZF library code, the aliases should typically follow these patterns:
- If aliasing a namespace, use the final segment of the namespace; this can be accomplished by simply omitting the "as" portion of the alias:
- If aliasing a class, either use the class name (no "as" clause), or suffix the class with the subcomponent namespace preceding it:
Abstract classes will be prefixed with the word "Abstract": AbstractController, AbstractForm, etc.
Interfaces should be named descriptively and sufficiently generically to ensure they do not conflict with concrete implementations while still accurately indicating the purpose of the interface. Examples include:
Type hints will use available aliases (as declared using "use" statements) whenever possible. If a classname appears only once within the scope of the defined class, a fully qualified name may be used, but we strongly encourage defining an alias to facilitate documentation of dependencies.