[TYPO3-dev] Official coding guidelines of TYPO3
Andy Grunwald [wmdb]
andy_grunwald at arcor.de
Thu Apr 23 20:46:52 CEST 2009
Dmitry Dulepov schrieb:
> Here is the recent draft that core team uses de facto:
> http://forge.typo3.org/repositories/entry/typo3v4-core/Documentation/trunk/doc_core_cgl/doc/doc_core_cgl.sxw?format=raw
>
Thanks Dmitry for your fast answer.
Is this a draft already or are this the final coding guidelines? Will
there be changes in the near future?
And i have some questions about the "PHP syntax formatting" section:
1. I find the following lines in the document:
> Variables on the global scope may use upper case and underscore
characters.
> Examples:
> $TYPO3_CONF_VARS
> $TYPO3_DB
I´ve read (but i don`t know where) that is recommended to use
$GLOBALS['TYPO3_DB'] instead of $TYPO3_DB, because you could remove
those lines in different methods:
function example(){
global $TYPO3_DB, $LANG, ...;
...
}
Is this recommended and is there a "mistake" in this document or is my
last sentence wrong?
2. I find the following lines in the document:
> The opening curly brace is always on the same line as the preceding
construction. There must be a space (not a tab!) before the opening
brace. The opening brace is always followed by a new line.
Why there is no guideline for the following example (i cant find one)?:
$variable = 5;
OR
$variable=5;
In my opinion this is very important because the first version
($variable = 5;) is easier to read. The second advantage for the first
version is that this is similar to the "String"-Guidelines (Page: 11 / 12):
> $content = 'Hello ' . 'world!';
Best regards from Germany,
Andy
More information about the TYPO3-dev
mailing list