Prior to PHP 5.3 I used to name interfaces/abstract classes like this:

abstract class Framework_Package_Subpackage_Abstract {}

interface Framework_Package_Subpackage_Interface {}

Now with PHP 5.3 and using namespaces I can't use my convention anymore, because interface and abstract are reserved keywords.

namespace Framework\Package\Subpackage;
abstract class Abstract {}

namespace Framework\Package\Subpackage;
interface Interface {}

So, what should I name my classes/interfaces like?

Thx for any suggestion! :-)


Hasn't abstract/interface been reserved keywords since PHP5?

Written by Imran

yep, they are ; but, using names like Framework_Package_Subpackage_Abstract for classes solved the problem of having these words alone as classnames.

Written by Pascal MARTIN

but that wasn't a problem so far, cause the interface's name include the whole package path for autoload purposes.

Written by Philippe Gerber

Accepted Answer

SubpackageAbstract, SubpackageInterface

Written by erenon
This page was build to provide you fast access to the question and the direct accepted answer.
The content is written by members of the community.
It is licensed under cc-wiki