[TYPO3-core] Coding Guidelines about PHP Namespaces

Thomas Maroschik tmaroschik at dfau.de
Sun Mar 24 22:53:14 CET 2013

Hi Jigal,

Am 24.03.13 13:32, schrieb Jigal van Hemert:
> This looks highly confusing. Why is a class called "Annotations" if you
> use it in the code as "Flow".
> use TYPO3\CMS\Core\Authentication\BackendUserAuthentication as DataHandler

You have to know Flow for that special case. You import in the example a 
namespace and not a classname. There is no Annotations class there. You 
need this for the doctrine annotations reader to work. Every annotation 
is represented by a class.

So imagine a class like the following with the scope annotation:

  * A sample class
  * @Flow\Scope("singleton")
class SomeClass {

The annotation is resolved to TYPO3\Flow\Annotations\Scope which isn't 
confusing at all anymore. If you would just import 
TYPO3\Flow\Annotations without the Flow alias the class would have to be 
tagged like this instead:

  * A sample class
  * @Annotation\Scope("singleton")

Decide for yourself which one is more confusing ;)



More information about the TYPO3-team-core mailing list