Spaces around dots

One of the first odd things that one finds when starting to work with WordPress code is the excessive use of spaces. Something like:

do_something('Words of '.$widget->noun($attrs['ish']));

becomes the the stretched out:

do_something( 'Words of ' . $widget->noun( $attrs['ish'] ) );

Which is fine, and actually now I’ve been using it for a decade I’m pretty comfortable reading it. But it’s uncommon in the PHP world. (And note the singular place in which spaces aren’t used: the array key, iff it’s a string.)

Not only that, but I just recently realised that the PHP CodeSniffer sniffs for WordPress don’t actually check for the spaces around the concatenation operator. I’ve filed an issue for that.


Retrieved from ‘https://samwilson.id.au/index.php?title=Spaces_around_dots&oldid=381