8
rant1ng
5y

I'm a php developer

I don't like
If (something) {
//code here
}

I like
if (something)
{
//code here
}

Sorry.

EDIT:

However, in javascript, I'm fine with the first example. I may need professional help.

Comments
  • 4
    Well, you are close to psr-2 standard.

    Class definitions and method braces go on a new line.

    If else statements however, would require to be on the same line.

    It ain't a crime to go against this. But, you know :P
  • 2
    Depends on de amount of conditions how I do things... I always start checking all negative things though....

    if(
    idontlikethis
    ){
    return fu..
    }

    if(
    idontlikethiseither
    ){
    return fu..
    }

    return whateverwhenilikeyou;
  • 3
    Senseless whitespace
  • 2
    There are bigger fish to fry than where the brackets are. It's normally all the shite inside them that pisses my off rather than the brackets themselves.
  • 3
    Reconfigure your phpcs and/or phpmd (i dont remember which). You can adept PSR for your needs, like I did. I heavly dislike some portions of PSR but love others.
  • 1
    I like #2 more too. I was raised on the C family, its what we do and for me at least code reads much cleaner with #2. #1 is more compact and looks fine, but #2 makes things very obviously separated into chunks and my eyes and brain have a better time reading and compiling it with those "mental" separators
  • 1
    @Hazarth

    exactly how I feel
  • 2
    Respect the fucking PSRs standards if you're writting php.
  • 0
    Why do you prefer the second option? Also is the style called Allman or is that just something I heard?
  • 1
    Try pl/SQL and VB, then you get

    If blah Then
    Some code
    End;
  • 1
    @Lyniven What if I say no? Some PSR things are annoying me and I much prefer writing in coding standard that feels most readable?
  • 4
    a?b:c;

    That's good enough for me.
  • 2
    @ewpratten <presses ++ very hard>
  • 0
    or maybe I should use this... ?

    https://github.com/FriendsOfPHP/...
  • 2
    @ewpratten

    yeah, ....but that becomes a bitch to untangle and add lines if you ever need to
  • 1
    Holy shit you're gonna love GOLANG
  • 1
    I'm a top one guy.
    It stops me from adding ; at the end of a if and executing the next line regardless.

    But each to their own.
    I do like a lot of the PSR's but something.... meh.
  • 1
  • 1
    @zuley That's Allman style, yes.

    I usually use that bracing style, unless there's a coding style that says otherwise. For me it's easier to see how the code is structured that way.
  • 0
    @DubbaThony if you don't respect the most widely used and recognized standards, I'll just assume you don't respect anything else in your code, write bad quality, unbearable shit code.
  • 2
    @Lyniven Assume what you want, I respect most of PSR but rest I change and stay consistant. For example:

    if () {
    or
    if() {

    One of them is PSR second not. Guess which drives me absolutely nuts?

    Edit,
    Oh, and Im also tab guy, not spaces guy. So thats another thing i change. That may be your shittieness measure, whatever.
  • 1
    @DubbaThony you share the same thoughts as i do for some of the PSR's :D
  • 2
    @C0D4 So you know, we are making shitty unmaintainable code, so here is that 😂😂😂
  • 1
    @DubbaThony one mans shit is another mans treasure... 😅
  • 2
    @C0D4 Does that mean we should fork PSR and fix it in some regards and call it "unmaintainable but treasure"?
  • 1
    @DubbaThony nah, I'm thinking "PSR - the right way"
  • 1
    @C0D4 oh ya. Definitely.

    Or maybe simple tool that unfucks and fucks up code (changes between exacly user's favourite flavour of PSR to fully-fleded PSR just before push and reverse on pull)...

    That's actually interesting idea and I guess its doable with existing tools so it would be simple bash script. hrmmm....
  • 0
    @DubbaThony

    I'm in marketing 20 years

    What you described would definitely be a hit/sell/famousgithub/ etc.

    You should do it if you want those things, cuz it's guaranteed going to take off, especially if you consider that PSR can only become more nitty, not less. The timing is right on.
Add Comment