[TYPO3-core] Coding Guidelines about PHP Namespaces
Karsten Dambekalns
karsten at typo3.org
Mon Mar 25 09:53:54 CET 2013
Hi.
On 24.03.2013, at 22:53, Thomas Maroschik <tmaroschik at dfau.de> wrote:
> 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.
I disagree with the "You have to know Flow for that special case" statement :) This is regular namespace use in PHP that can be used everywhere a PHP namespace can be used. Neither tied to Flow nor to Doctrine Annotations.
But the way this is somehow more understandable in a Flow context is indeed coming from Doctrine, as they use "ORM" as default namespace alias in their documentation, which we stick to and copied for our own annotations".
Also it helps if you keep "use" in mind as "use" - *not* "import" because nothing is imported. It just acts as a "search and replace" in a (rough) sense.
Regards,
Karsten
--
Karsten Dambekalns
TYPO3 Core Developer, Neos / Flow Team
TYPO3 .... inspiring people to share!
Get involved: typo3.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2216 bytes
Desc: not available
URL: <http://lists.typo3.org/pipermail/typo3-team-core/attachments/20130325/3b0a455a/attachment-0001.bin>
More information about the TYPO3-team-core
mailing list