I'm reading through the Zend Framework coding standards, where they state that curly brace after a Class definitions should be on the next line, the "one true brace form".
class MyClass
{
function....
}
I usually have the braces on the same line:
class OtherClass {
function ...
}
What's the reason for putting the brace on the next line? Or using any other style, for that matter?
Having the braces on lines by themselves helps to visually separate the inner part from the outer part. That makes it easier to quickly scan through source code and distinguish blocks from their surroundings.
Plus, having the braces at the same indentation level makes it easier for the eye to find a match.
Personal preference is really the only real "reason".
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With