[TYPO3-dev] Coding guidelines questions: commas in array, tabs

Ingo Renner ingo at typo3.org
Tue May 20 10:10:02 CEST 2008


Oliver Klee wrote:


> 1. We decided that there should be a comma even after the last element 
> of an array:
> 
>   $foo = array(
>     'bar',
>     'foobar',
>   );
> 
> 
> 1a. Should this also apply to single-element arrays?
>   $foo = array(
>     'bar',
>   );
> 
> (My vote is to *keep* the comma in this case. -> *no* exception to the 
> general rule)

right

> 1b. Should this also apply to arrays that use one line only?
>   $foo = array('bar');
>     vs.
>   $foo = array('bar',);
> 
>   $foo = array(11, 42);
>     vs.
>   $foo = array(11, 42,);
> 
> (My vote is to *drop* the comma in this case. -> *exception* to the 
> general rule)

right

> 2. We decided that tabs should only be used at the beginning of lines, 
> but not after a non-tab character.
> 
> Does this also apply to tabs after @param, @return, @author?
> 
>   @param<tab>integer<tab><tab>number of elements to display, must be > 0
> 
> 
> (My vote is to use *spaces* in this, not tabs. -> *no* exception to the 
> general rule)

wrong, use tabs as shown in your example - although that might change 
again, I just have to look it up how javadoc and/or phpdoc handle that


Ingo

-- 
Ingo Renner
TYPO3 Core Developer, Release Manager TYPO3 4.2




More information about the TYPO3-dev mailing list