Saturday, March 12, 2011

Zend Framework 2 Coding Standards draft discussion

Zend Framework Project Lead Matthew Weier O'Phinney presented a working draft of Zend Framework 2 Coding Standards.

Here are some outlines from this draft document according the changes we will have comparing to Zend Framework 1.x :
  • For any custom piece of code you should utilise a separate PHP namespace.
  • Namespaces are mapped 1:1 to directories.
  • Underscores "_" will not have a special meaning any more, but possibly still be mapped to directories inside component hierarchy.
  • MixedCase naming convention will be used instead of UPERCASE for acronyms (not a change, but anyway worth mentioning as there were a hot discussion about this)
  • Abstract classes should be prefixed with "Abstract" keyword.
  • Interfaces will not have "Interface" keyword and should be named with nouns or adjectives.
  • Function in global scope is discouraged, its better to define functions in a separate namespace or as a static method.
  • ... and a lot of new staff related to Namespaces...
Note that this document is still in active development and discussion, so nothing is final here and can be changed possibly by you! Just join the contributors mailing list discussion.