[TYPO3-dev] [tip] how to let your IDE know about $GLOBALS['TYPO3_DB']

Ivano Luberti luberti at archicoop.it
Thu Mar 20 14:35:08 CET 2014


Generally speaking in PHPStorm you can use a notation like this

/* @var $myVar myClass */
$myVar = whateverStatementForFirstVarUsage;

and have autocompletion working in your PHP code.

Both your suggestion and mine where already published in an old post on
this list but it is nice to up it from time to time


Il 20/03/2014 13:17, Stefano Cecere ha scritto:
> i just want to share this idea (working well! at least under PhpStorm)
> to let your IDE know about the functions of $GLOBALS['TYPO3_DB']
> (which is an instance of t3lib_DB:
>
> in my class i add a function like :
>
>     /**
>      * @return t3lib_DB
>      */
>     protected function getTYPO3_DB()
>     {
>         return $GLOBALS['TYPO3_DB'];
>     }
>
>
> and then i just init the class with a
> $TYPO3_DB = $this->getTYPO3_DB();
>
> from now on the IDE knows that $TYPO3_DB is class t3lib_DB..
> with all the benefits/autocompletion/checks! :)
>
> i use the same procedure for any other $GLOBAL[] class
>
> PS: it would be time to get rid of $GLOBAL in TYPO3 core! (ever tried
> to debug $GLOBAL['TSFE] ? :)
>
>
>
> -- --- ----- -------
>
> Stefano Cecere
> KRUR studio - http://krur.com
> _______________________________________________
> TYPO3-dev mailing list
> TYPO3-dev at lists.typo3.org
> http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-dev
>

-- 
==================================================
dott. Ivano Mario Luberti
Archimede Informatica societa' cooperativa a r. l.
Sede Operativa
Via Gereschi 36 - 56126- Pisa
tel.: +39-050- 580959
tel/fax: +39-050-9711344
web: www.archicoop.it
==================================================




More information about the TYPO3-dev mailing list