The WP core, many WP plugins, and the WP coding standards themselves use a very "generous application" of the Space character (not for indentation, but "inside" of parens and brackets). This seems to be unique to Wordpress - this style/philosophy does not seem to be present in other similar projects, PHP or otherwise.
For more information on this approach, see: https://make.wordpress.org/core/handbook/coding-standards/php/#space-usage
Example: foreach ( (array) $foo as $bar ) { ...
I'm referring to the space after foreach, after the first (
, and before the final )
(and other similar spaces shown in "Space Usage" at the link above).
This style seems unnecessary to me - it requires more typing and (opinion)makes parsing code visually more difficult.(/opinion)
My desire is not to debate whether or not this style is a good idea. Rather, I simply want to understand the motives for why this is the recommended style. Even commenters on the WP coding standards are curious:
The answers provided to MK Safi's question are essentially:
- For readability
- Status quo (aka "That's just the way it is")
My reasoning for asking is that I personally don't see much value in adopting the WP coding standards (regarding "Space Usage") in our internal-only projects. However, I'm curious if I'm missing something.
Are there any reasons beyond the two listed above, ostensibly valid or not, for following Wordpress' "Space Usage" style?