[TYPO3-dev] Official coding guidelines of TYPO3

Peter Russ peter.russ at 4many.net
Wed Apr 22 16:53:44 CEST 2009


--- Original Nachricht ---
Absender:   Dmitry Dulepov
Datum:       17.04.2009 20:13:
> Hi!
> 
> Andy Grunwald [wmdb] wrote:
>> In my search for the official coding guidelines i`ve found 3 versions:
>> typo3.org: last update: 28.04.2007 11:36
>> http://typo3.org/documentation/document-library/core-documentation/doc_core_cgl/current/
>>
>> wiki.typo3.org: draft version
>> http://wiki.typo3.org/index.php/TYPO3_Coding_Guidelines_-_Notes
>>
>> Dmitry Dulepovs blog: result of discussion by TYPO3-(Core-)Team
>> http://dmitry-dulepov.com/article/get-typo3-coding-guidelines-here.html
>>
>> So i dont know which coding guidelines are to use. Any idea?
> 
> 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
> 
> It is awaiting approval from the TYPO3 core team leader.
> 

Just my toughts about curly braces:
IMHO PHP style is not the best way to do so. I still prefer the C style 
of starting the opening urly brace in a new line as this code is much 
easier to check (from the usability sight of development and reading)

Check this:
protected function getForm() {
	if ($this->extendedForm)
		// generate extended form here
	} else {
		// generate simple form here
	}
}

protected function getForm()
{
	if ($this->extendedForm)
		// generate extended form here
	} else {
		// generate simple form here
	}
}

Where is the mistake?

What's about a class extending an other implementing different 
interfaces: the curly brace gets lost...
class tx_myextensions_pi1 extends t3lib_someextension
	implements
		interface_something,
		interface_other {
	__construcct() {
	}
}


class tx_myextensions_pi1 extends t3lib_someextension
	implements
		interface_something
		,interface_other
{
	__construct()
	{
	}
}



So my conlusion: PHP has to differentiate somehow from JAVA. But the 
curly brace thing isn't the best example to be used as TYPO3 cgl!

Peter.




-- 
Fiat lux! Docendo discimus.
_____________________________
uon GbR

http://www.uon.li
http://www.xing.com/profile/Peter_Russ




More information about the TYPO3-dev mailing list