[TYPO3-core] Coding Guidelines about PHP Namespaces

Anja Leichsenring aleichsenring at ab-softlab.de
Sun Mar 24 11:16:29 CET 2013


Hi,

I would prefer to use the 'use' statement without the 'as', after 
Phpstorm handles imports this way.

Greetings
Anja

Am 24.03.2013 10:41, schrieb Benjamin Mack:
> Hey,
>
> as I recently have some commits flying around where "bugfixes" introduce
> the namespaces declaration "use" like this
>
> namespace TYPO3\CMS\Frontend\ContentObject;
> use TYPO3\CMS\Core\Utility\GeneralUtility;
>
> I feel like we should have some kind of definition when or for what kind
> of namespaces we want to use "use", but then do it everywhere where it
> makes sense. This info should be added to the official CGL, otherwise
> we'll have some really dirty code, even after the namespaces cleanup ;-).
>
> 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'm not a namespace expert but this seems logical for me to make the
> code more descriptive.
>
> I could also live with "don't use "use" at all".
>
> My other option to make the cleanup complete:
>    use TYPO3\CMS\Core as t3lib;
> ;-)
>
>
> Thanks for your feedback.
> Enjoy!
>
> Benni.
>



More information about the TYPO3-team-core mailing list