[TYPO3-core] CGL :: New rule to harmonize coding style of "if constructs" (and the like)?
Roland
most.wanted at gmx.at
Wed Jun 6 22:28:24 CEST 2012
hi stefano,
nice to hear that everybody would like to see this feature.
i already voted for it in the afternoon.
please tell me if/how i can help.
kind regards.
roland
Stefano Kowalke <blueduck at gmx.net> wrote:
> Hi Roland,
>
> thanks for bringing this topic up.
>
> Please vote for the issue at http://forge.typo3.org/issues/36614.
>
> Stefano
>
> Am 06.06.12 07:16, schrieb Roland:
>> Hi everybody,
>>
>> Wouldn't it be great if all "if constructs" (and the like) would be
>> styled the same way. Would make the code more readable.
>>
>> I think this is not part of the CGL at the moment. I would like to hear
>> your opinion if you would also like to have harmonized coding style of
>> all "if constructs" (and the like).
>>
>> My suggestion:
>>
>>
>>
>> FALSE:
>>
>> if($a == $b) {
>> // do something
>> }elseif($a == $c){
>> // do something else
>> }else{
>> // do something else
>> }
>>
>>
>>
>> RIGHT:
>>
>> if ($a == $b) {
>> // do something
>> } elseif ($a == $c){
>> // do something else
>> } else {
>> // do something else
>> }
>>
>>
>>
>> it is all about the space between "if" and "(". in the CGL space is
>> always used - but not mentioned as far as i am right: [1]
>>
>> the same is true for "do", "while", "for" and "each".
>>
>> maybe there should be rules for these situations? would help to
>> harmonize the coding styles and would be VERY easy (and very less error
>> prone too) to correct and review.
>>
>> please also see [2] and [3].
>>
>> what do you think?
>>
>> kind regards.
>>
>> roland
>>
>>
>> [1]
>> http://typo3.org/documentation/document-library/core-documentation/doc_core_cgl/4.5.1/view/
>>
>> [2] http://forge.typo3.org/issues/37777
>> [3] https://review.typo3.org/#/c/11843/
More information about the TYPO3-team-core
mailing list