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

Stefano Cecere scecere at krur.com
Thu Mar 20 13:17:53 CET 2014


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



More information about the TYPO3-dev mailing list