[TYPO3-dev] Coding guidelines questions: commas in array, tabs
Steffen Kamper
steffen at sk-typo3.de
Mon May 19 17:03:53 CEST 2008
Hi Oliver,
"Oliver Klee" <typo3-german-02 at oliverklee.de> schrieb im Newsbeitrag
news:mailman.1.1211208606.17011.typo3-dev at lists.netfielders.de...
> 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)
>
i think we said to use the comma in every case, also with a single element.
Main reason is, if you add an element you don't have to change the line
before.
>
> 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)
>
i wouldn't use the comma here. When you add a value you change this line
anyway.
>
> 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)
>
how does IDE format this, or extdeveval?
In general i'm for spaces as they are used for optical alignment.
vg Steffen
More information about the TYPO3-dev
mailing list