13

For the love of all things sacred, put a damn space between your parentheses and whatever comes before/after them. It is totally not cool to read if(expression){}.

No, seriously, I mean that.

Comments
  • 2
    It's *especially* not cool when you modify my code (which *did* have it spaced correctly) to condense it into the aforementioned abomination.

    No, seriously. It's even against the design standard our company is purportedly following.

    Just. Don't. Do it.
  • 1
    Do you mean

    if ( expression ) {

    }

    or

    if (expression) {

    }

    ?
  • 3
    I'm more of a

    if (expression) {
    ...
    }

    kind of guy. I (personally) find it very distracting to read code similar to:

    if ( expression ) {
    ...
    }
  • 2
    @Jantho1990 then why dont you have an auto format on commit? Saves man hours of arguments in the long run
  • 1
    if (expression) {

    }

    That is what I meant. Though

    if ( expression ) {

    }

    is still more readable than

    if(expression){

    }
  • 0
    @musician Not my code, someone else is doing it and our team does zero automated style enforcement.
  • 2
    @Jantho1990 well time to bring it up in a meeting then. Forced coding guidelines (even if you dont 100% agree with them) helps everyone and will bring and end to useless discussions. I for example disagree with the space before the parentheses because to me the ( is enough seperation. But if it was enforced I wouldnt care about it and let the linter do the job.
  • 1
    Oh I personally can't stand spaces there! I always remove them if any or if they appear while programming 😥
  • 0
    I use the php-cs-fixer tool to fix any formatting issues I forgot about, as well as anything that a team member did. With a large enough codebase that doesn't get checked, take a moment to enjoy others pain as they pull the commit off just formatting fixes.
  • 1
    if )expresso (
  • 1
    I believe OP meant space before and after parentheses, not in between of them.
Add Comment