Right, code police time….

 

“If( “ occurs 2168 times in core api’s

“if ( “ occurs 529 times in the core api’s

 

“if(“ is used 220 times in /

“if (“ is used 1292 times in /

 

Victor: you seem to use “if (“ – which is what our historical code guide standards state (iirc, we differ from the php standards we loosely follow on this point

Damien: you’ve done code tidyup’s recently fixing “if (“ to “if(“

 

I think what’s actually happened here (and the reason I posted the split of where it’s used), is the original code has used “if (“ – and the newer developers/authors have used “if( “. (I know I have at least)

 

Personally, I prefer if( as it’s more inline with what we do with other function calls e.g. if( config_get( $foo ) ) { … } means we treat the whitespace the same for any function call. Equally, I think I recall that the code guidelines state to use $foo[‘bar’] with no spaces for arrays – I’m pretty sure I’ve been guilty of adding spaces to arrays in the past, and I think I’d probably go with the code guidelines being correct in terms of not adding spaces, and me as being wrong in this case for readability.

 

That said…, I don’t really care what is deemed to be correct as whatever we choose, at some point I’ll find a language/editor/project that does the opposite style, however can we pick ONE of the two!!! Equally, I’d suggest we’d tidy this up just before a 1.3 branch once we’ve not got outstanding patches to make everyone’s life a bit easier:

 

So which of the following should be the correct version to use going forwards:

 

a)      If( config_get( $t_foo[ ‘bar’ ] ) ) { … }

b)      if( config_get( $t_foo[‘bar’] ) ) { … }

c)       If ( config_get( $t_foo[‘bar’] ) ) { … }

d)      If ( config_get( $t_foo[ ‘bar’ ] ) ) { … }

 

C I believe represents our code standards, A seems to be what we’ve been using in more recent code.

B/D I think i.e. space in [] I think occur few enough times in the code to represent a typo by the author

 

Victor/Damien – pick one! J

 

Paul