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

Oliver Klee typo3-german-02 at oliverklee.de
Mon May 19 16:50:06 CEST 2008


Hi everybody,

after the (very productive!) coding guidelines (CGL) session at the 
T3DD08, I wondered about three possible special cases of or exceptions 
from the rules we decided on.

I'd like know whether this already is covered by the new CGL (and I just 
missed it) or how this should be handled.


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)


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)


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)


Best regards,


Oliver




More information about the TYPO3-dev mailing list