[TYPO3-core] RFC: CGL changes (closing php tag, multiline string concate)

Alexander Opitz opitz at pluspol.info
Wed May 22 13:45:25 CEST 2013


Heyho,

I would like to discuss 2 changes to the TYPO3 CGL.

1) Remove closing PHP Tag and add one empty line

http://docs.typo3.org/typo3cms/CodingGuidelinesReference/PhpFileFormatting/GeneralRequirementsForPhpFiles/Index.html#php-tags

At the moment we have a closing php tag and no new line after that tag 
course of output compression and AJAX errors (so is it documented). But 
this makes the difftools sometimes unhappy "There is no newline at the 
end of the file".

Thats why I'd like to remove the closing php tag "?>" and add a new 
line. This solves both problems and is PSR2 standard.

https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md#22-files


2) Change the multiline string concate from dot on last line to next 
line and remove the extra indentation.

http://docs.typo3.org/typo3cms/CodingGuidelinesReference/PhpFileFormatting/PhpSyntaxFormatting/Index.html#strings

I find it more readable:

Now:
 > $content = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. ' .
 >                 'Donec varius libero non nisi. Proin eros.';

Then:
 > $content = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. '
 >     . 'Donec varius libero non nisi. Proin eros.';

A better example is:

 > aFunction(
 >     'Lorem ipsum dolor sit amet, consectetur adipiscing elit. ' .
 >     'Donec varius libero non nisi. Proin eros.'
 > );

vs.

 > aFunction(
 >     'Lorem ipsum dolor sit amet, consectetur adipiscing elit. '
 >     . 'Donec varius libero non nisi. Proin eros.'
 > );

as it differs better from two parameters.

 > bFunction(
 >     'Lorem ipsum dolor sit amet, consectetur adipiscing elit. ',
 >     'Donec varius libero non nisi. Proin eros.'
 > );


Greetings Alex//


More information about the TYPO3-team-core mailing list