We are revising the coding standards, and the new standards will be published in the manual for 1.8. There are several concerns:
- When we move to using namespaces:
- having a final segment of just "Interface" or "Abstract" will not work, as they are reserved keywords
- the interface and the framework's concrete implementations should be in the same namespace
- A desire to stay away from Hungarian Notation
- A desire to comply with forthcoming PEAR2 standards:
A summary of the new rules is as follows:
- Interfaces must be named descriptively, and fall under the same namespace as implementations
- Abstract classes should be named descriptively, but may include the suffix "Abstract" as part of the classname
- Abstract classes must fall under the same namespace as implementations
The reason we want the interfaces/abstracts to fall under the same namespace as implementations is to make it easy to package individual components, as well as to import and alias a single namespace .
To give an example, consider the following PHP 5.3 namespace-aware implementations:
namespace zend\application\bootstrap;
interface Bootstrapper
{
}
abstract class BootstrapAbstract implements Bootstrapper
{
}
class Bootstrap extends BootstrapAbstract
{
}
In a userland implementation, you might have the following:
namespace website;
use zend\application\bootstrap as App;
class Bootstrap extends App\Bootstrap
{
}
These changes to the standards have been discussed on the zf-contributors mailing list.
We are revising the coding standards, and the new standards will be published in the manual for 1.8. There are several concerns:
A summary of the new rules is as follows:
The reason we want the interfaces/abstracts to fall under the same namespace as implementations is to make it easy to package individual components, as well as to import and alias a single namespace .
To give an example, consider the following PHP 5.3 namespace-aware implementations:
In a userland implementation, you might have the following:
namespace website; use zend\application\bootstrap as App; class Bootstrap extends App\Bootstrap { }These changes to the standards have been discussed on the zf-contributors mailing list.
- When we move to using namespaces:
- having a final segment of just "Interface" or "Abstract" will not work, as they are reserved keywords
- the interface and the framework's concrete implementations should be in the same namespace
- A desire to stay away from Hungarian Notation
- A desire to comply with forthcoming PEAR2 standards:
- http://wiki.php.net/pear/rfc/pear2_class_naming
- http://wiki.php.net/pear/rfc/pear2_naming_standards
A summary of the new rules is as follows:- Interfaces must be named descriptively, and fall under the same namespace as implementations
- Abstract classes should be named descriptively, but may include the suffix "Abstract" as part of the classname
- Abstract classes must fall under the same namespace as implementations
The reason we want the interfaces/abstracts to fall under the same namespace as implementations is to make it easy to package individual components, as well as to import and alias a single namespace . To give an example, consider the following PHP 5.3 namespace-aware implementations:namespace website; use zend\application\bootstrap as App; class Bootstrap extends App\Bootstrap { }