[TYPO3-core] RFC: #9416: Code Cleanup for lang.php

Stefano Kowalke blueduck at gmx.net
Mon Sep 29 12:50:23 CEST 2008


Hi Benni,

i take the CGL notes, which i found here on the list, to my user page 
http://wiki.typo3.org/index.php/TYPO3_Coding_Guidelines_-_Notes

I added some examples to a few rules. You are wellcome to add more examples.

Wikis are not the best solution for a Guideline, but first i make this for
me as a kind of manual.

@Comments:

> ...the comments should have
> the same indention as the code itself.

Like this:
                // Defined global here!
                $tmpl = t3lib_div::makeInstance('t3lib_tsparser_ext');
                // Do not log time-performance information
                $tmpl->tt_track = 0;    
                $tmpl->init();

i think if the comments have the indention of one tab more
as the code its better to read:

                        // Defined global here!
                $tmpl = t3lib_div::makeInstance('t3lib_tsparser_ext');  
                        // Do not log time-performance information
                $tmpl->tt_track = 0;    
                $tmpl->init();



> ...As far as it goes for the
> comments in the class attributes, I think we should stick to the rule
> and keep the description in the same line after the actual variable.

        public $tce_processed = false;  // indicator for t3editor, whether
data is
stored
        public $something;  //Some comment after the attribute

instead of:

                // indicator for t3editor, whether data is stored
        public $tce_processed = false;  
                //Some comment after the attribute
        public $something;  



> * While you're at it: With the recent change in initializing $LANG in
> the init.php, we need to modify the comment
>   * Initializes the backend language.
>   * This is for example done in typo3/template.php with lines like these:
>   *
>   * require (PATH_typo3.'sysext/lang/lang.php');
>   * $LANG = t3lib_div::makeInstance('language');
>   * $LANG->init($BE_USER->uc['lang']);
> and tell everybody that we're doing a
 
@Steffen: it was your patch, could you write a new header comment for 
init() in typo3/sysext/lang/lang.php? 



> * One important one: Tabs should only be used in the beginning of lines.
> Something like this
>    if (...)   {
> always needs to go. You can actually do a nice search & replace on
> ")\t{" => ") {", to cover most of this.
> 
> * If there are any if statements without {}, please rewrite them to
> if () {
>    ...
> }

Done



Stefano

-- 
GPG-ID: 0x2B08936D
Key-Fingerprint: 7F31 BCF0 70C0 B3B1 1235 07E9 1777 D7A0 2B08 936D


More information about the TYPO3-team-core mailing list