[TYPO3-dev] Official coding guidelines of TYPO3
Franz Holzinger
franz at ttproducts.de
Fri Apr 24 18:15:41 CEST 2009
Hello,
Dmitry Dulepov a écrit :
>> The CGL says: "Use of global is not recommended. Always use
>> $GLOBALS['variable']."
>>
>> But why do you recommend the longer way to use $GLOBALS['TYPO3_CONF_VARS
>> '] instead of $TYPO3_CONF_VARS? Maybe it is because 'global'
>> declarations might not work in some cases.
>> It is easier to write and read if the variable names are shorter.
>
> It is because sometimes people forget to write "global $WHATEVER" or accidentally delete it and it causes hard to catch errors.
>
> What would you prefer: shorter code or smaller chances of errors?
I prefer shorter code. This is easier to read and understand. A deletion
of a line might always cause errors.
Developers will learn to insert the global statements they need.
>> And it causes red code warnings in the EM if you follow the Coding
>> Guidelines:
>> No XCLASS inclusion code found in file "lib/class.tx_extkey_filename.php"
>
> With the current EM — yes. There is a bug report about it. It needs a different regexp in the EM.
A patch is available: http://bugs.typo3.org/view.php?id=7753
- Franz
More information about the TYPO3-dev
mailing list