Coding style update -- does the concat operator coding style make sense?
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
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
Konstantin Käfer skrev:
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.
It also means that most patches for D7 are now broken, so if you have a patch in the queue, go ahead and check that it still applies and be quick with the re-roll before someone marks CNW. ;) -- Sincerely, Frederik 'Freso' S. Olesen <http://freso.dk/>
participants (3)
-
Earl Miles -
Frederik 'Freso' S. Olesen -
Konstantin Käfer