if curly bracket

I just switched from doing this:




if(condition){

     //stuff

}



to this:




if(condition)

{

     //stuff

}



and I LOVE IT! I just wanted to let somebody know…

Is this troll bait? :lol:

I favor curlies on their own line for C++, but oddly enough, I’ve grown to like the first way as it seems to look neater for PHP…

Strange, isn’t it?

No seriously.

I usually end up adding an empty line if I do it the first way anyway, and now I feel like my code has been cleaned up sooooo much.

Yii’s style is the second method… plus the awful “no brackets” which I detest (except on single line).

I have not bothered to break out of my years long habit of the first method, except perhaps for method declarations (Yii influence)… anything inside the method still has my usual way…

I think first method looks better, takes up less space and is more readable.

I agree with the "no brackets" - they are the bane of my coding existence!

Yii2 will use K&R.

K&R is cool (although I didn’t know it has a name :D)

@bennouna

I’d prefer Allman style.

(The discussion on coding style is very much fun, as long as it doesn’t flame up to be a religious war. :D )

Good link on indent style. I now know that I’m an Allman Stylist.

Ewww, imagine using Whitesmiths style. Sick.

Coolies… have been using it for years… slightly corrupted now by Yii, but will be easy to slip back into what I am accustomed to.

Any idea when we can get a peek at Yii2?

I was Allman all the way until a few years ago.

Now I’m K&R-ish.

So it sounds great that Yii will follow the latter convention. :)

Wait, what ? Why is that ? one of the reasons i choose yii in the first place was the coding style, why do you change to K&R which i personally(and many others) don’t like it ?

I prefer the Allman style, which looks better. With k&r, nested structures looks like shit, too hard to follow.

Shouldn’t this be a pool at least so that we have something to say about ?

I just see myself wasting tone of time correcting the Gii generated code, this is a real bummer…

Since it’s already using K&R what’s the problem?

The only change will be that it will be consistent. :)

I agree that the generator could use customizable templates, or at least have some options (spaces/tabs/etc).

i m using Allman style… ::)

I also prefer Allman style, it is more readable, and easy to pair open and close brackets without IDE help.