[development] Coding style update -- does the concat operator coding style make sense?

Konstantin Käfer kkaefer at gmail.com
Mon Apr 14 19:28:27 UTC 2008

Hi everyone,

the patch which changes the spacing for the concatenation operator got  
committed today. That means:

 From Drupal 7 onwards, there is a space on *both* sides of the concat  
operator (the . that connects strings) instead of just on the non- 
literal facing side.

<= Drupal 6:
$foo = "Lorem Ipsum". dolor_invoke();

 >= Drupal 7:
$foo = "Lorem Ipsum" . dolor_invoke();

This is in line with most other PHP coding styleguides and the  
conventions of most other C-style languages.

Konstantin Käfer -- http://kkaefer.com/

On 10.04.2008, at 22:33, Earl Miles wrote:
> Konstantin took some initiative after my umpteenth teeth-gnashing  
> fest over the inconcistency of the concatenation operator in  
> Drupal's coding standards.
> Personally, I Don't Get It. Why does the . operator have a different  
> coding standard than any other binary operator? Why does:
> 'foo'. $bar
> make sense, but
> 3+ $bar
> not make sense?
> I don't quite get the special relationship between strings and the .  
> operator that Drupal's coding standard espouses. Attempts to explain  
> it to me have, thus far, failed. Also, I've never seen this standard  
> anywhere else, not in any other language, nor anything even remotely  
> like it.
> Konstantin's patch to Drupal would remove this inconsistency and let  
> us change this standard: http://drupal.org/node/245115

More information about the development mailing list