[TYPO3-core] Coding Guidelines about PHP Namespaces
tmaroschik at dfau.de
Sun Mar 24 23:02:10 CET 2013
Am 24.03.13 10:41, schrieb Benjamin Mack:
> I suggest: Every core class has the following lines
> use TYPO3\CMS\Core as CMS;
> use TYPO3\CMS\Core\Utility as Utility;
> use TYPO3\CMS\Backend as Backend;
> use TYPO3\CMS\Frontend as Frontend;
I don't think that this is a good approach. Imho classes should have
minimal dependencies and the use of a "standardized use set" would
encourage people to couple classes again. This makes every refactoring
very hard as every dependency has to be considered.
Use the imports where it's necessary. My rule of thumb is something like
"is something used more then twice, then import", "is something from the
same namespace used more then twice, import the namespace". Maybe such
an advice could go into the CGL.
Thanks for bringing up this topic as many have maybe wondered about that.
More information about the TYPO3-team-core