122
Comments
  • 9
    Are you sure? Are you really sure?
  • 0
    This was in a PR to go to our staging environment
  • 3
    @TheGeekyGuy can't that be done like

    if($is_today)

    ?
  • 17
    To be, or not to be...
  • 1
    I dont know if id shoot myself or the original author
  • 1
    Hey, gotta check shit like that. It might be the third option!
  • 1
    Well that if statement has a few nested if statements... i have given up on fixing the users shit code (our site was outsourced) and we are rebuilding the whole thing in house now... so accept and move on :) not my problem
  • 3
    xD maybe, just maybe, it's all about the code style. Think about it, the code speaks louder than comments, so instead of removing the if statement and putting a comment like "// I don't care if it is_today or not" and author decides to make the code rhyme.

    Next up:
    if (toBe || !toBe) {}
    if (isFuture || isPast) {}
    if (yes && !no || definitelyYes || maybeOnlyThisTime) {}
  • 1
    Perhaps someone was trying to convey that it also works as for tomorrow, but didn't realize their boolean algebra skills were sufficient enough?
  • 1
    They forgot to test first is/is not today
  • 3
    developer probably just wanted to say that any day is good :)
  • 3
    I hope the statement is
    eat_pizza =true;
  • 1
    @C-Info i just had the same thought and realized that logically "if(to_be || !to_be)" isn't really a question after all, right?
  • 0
    OH GOD IT BURNS
  • 0
    @vortex everyone wants to eat pizza
  • 1
    @aikone I'm about to get myself some pizza...
  • 1
    @Aalhex cool, eat_pizza = true for you then 😂
  • 2
    @aikone That would on the other hand be null for you since you don't seem to having stocked up on pizza. 😄
  • 1
    @Aalhex yeah, no money, no pizza + NPE 😭
  • 2
    Make sure u explicitly check that pizza is null... we are in php land here.. false could also be null... oh and 0 could be too! Its a mine field out there
  • 0
    Laziness in programming at its finest :)
  • 1
    if (true || false) { ... } else { /* ??? */ }
Add Comment