Re: verify problem

From: Date: Sat, 07 Mar 2009 14:23:14 +0000
Subject: Re: verify problem
References: 1 2 3 4 5 6  Groups: php.general 
Request: Send a blank email to php-general+get-289544@lists.php.net to get a copy of this message
Ashley Sheridan wrote:
I'm more a fan of lining up opening and closing brackets so they are at the same indent level. It prevents one of the most popular errors caused by omitting a bracket, brace or other in the wrong place. A few extra line breaks in the code are not going to make a noticeable impact on the file size of the script!
It's fairly easy to check for missing } with my method as well statementA { statementa1 statementa2 statementa3 statementB { statementb1 statementb2 } You can see the missing bracket for statementA by seeing that statementB doesn't have one above it. I also generally create my } as soon as I create the { so I can comment the } identifying what it closes. I don't always comment it, but when I don't there are times I did when trying to track down a logic issue in nested loops. But - how to indent - if it's your project, whatever floats your boat, if it's a group project, you conform to the group specification for indenting (almost nothing is worse than several different indentation methods in a source file edited by multiple people - especially mixing real tabs and spaces, unix line breaks and dos line breaks.)

« previous php.general (#289544) next »