Mystery of the day: why some developers can't decide on a code style. Let's count:
- two types of brace placements
- three types of assignment spacing (with, without spaces, and aligned with extra space)
- two types of clause spacing
- mixed case in the first char of a variable for no apparent reason(?)
- bonus: unneeded parentheses

At least in ONE thing the person was consistent: no space between parameters!


  • 11
    Atleast they got one variable right, myJunk 😅

    Are you sure it's the same dev? Cause god help us if it was.
    But then if it wasn't, that's also scary why so close code looks so radically different.
  • 4
    @C0D4 I can only guess. There was no versioning system before I came by to upgrade PHP.

    And rant, of course. That's free, so great.
  • 2
    @M1sf3t I understand when code style evolves, but you mentioned exactly what's lacking: if someone changed code just above the "wrong one", update the rest of it too!

    IDEs are great on that: you configure a code style, press a shortcut, and magically all the file gets formatted.
    Also, linters exist for a reason: it's important to keep your style consistent if you ever plan to get outsider help. And even if you don't, practise it.
  • 4
    Can we please just point out the redundant cancer that is ^([ ]+) in this code?

    Why are there so many spaces in a "one of" search and why didn't they just use \s ?
  • 1
    @stonestorm lol, surprise surprise. That's a space AND A TAB!

    I only noticed it after the screenshot, so I couldn't add, but thanks for pointing it out.
  • 1
    @igorsantos07 But but... Does that even work? I've never been mad enough to try.
  • 0
    @stonestorm I guess so. In the end, \t and an actual tab are the same, right?

    I wouldn't suggest anyone to try, tho - unless you want to make someone else mad.
  • 0
    If the code is that bad, just use a linter to format all the code in the repo (php cs fixer 😉)
  • 1
    Wow. That's not legacy, that's.... Unusable.

    for with count...
    unnecessary variable init for list
    error propagation seems very wrong...
    list with missing check if empty for users...

    There is only one line I find appropriate in this whole code.

    Find it. XD
  • 1
    This code is a train wreck
  • 0
    What is that crossed equals sign in the last if statement? Is it something IDE replaces, like != ?
  • 1
    @Dozak Font ligatures
  • 0
    "But this code works bro"
    "Why does it matter how it looks"

Add Comment