Re: Coding Standards

From: Date: Thu, 24 Aug 2006 07:09:05 +0000
Subject: Re: Coding Standards
References: 1  Groups: php.pear.qa 
Request: Send a blank email to pear-qa+get-3904@lists.php.net to get a copy of this message
Darren McKee wrote: > Hi all, > > I'm currently in the process of developing the last coding standard > tests for the PHP_CodeSniffer package proposal > (http://pear.php.net/pepr/pepr-proposal-show.php?id=426). > > I've just got some questions about some coding standards that are not > documented in the "coding standards" section of the PEAR manual, but > seem to be implicitly implied from the examples used in that document, > and in most PEAR packages. Perhaps some of these are just "best > judgment" guidelines and not actually coding standards. > > My questions are: > > * Should there be a standard for spaces between default parameters and > their associated variable? The function definition page > (http://pear.php.net/manual/en/standards.funcdef.php) seems to suggest > that there should be a single space before and after the equal sign > for default values. If it's not documented, either way is allowed... > > * Should the case statements within a switch block be indented? The > control structures page > (http://pear.php.net/manual/en/standards.control.php) has an example > of a switch statement with the case tokens aligned with the switch > token. The rest of the coding standards seem to suggest that code > within curly braces should be indented 4 spaces. This one has been debated - basically the example doesnt show an indent, but alot of code in PEAR has the extra indent. -> you can choose to do it both ways, and it's valid.. > > * Should there be any standards enforced for a way to wrap lines? For > example, for function arguments, lines should be wrapped after the > comma used to separate arguments. For if statements, lines should be > wrapped after each conditional, etc. Trying to get CS changed/added, now that PEAR is so large has proven to be a little complex. - so as long as it follows the existing examples, packages may interpret them liberally, and can improve on them... Regards Alan Regards Alan > > Thanks, > Darren. >

« previous php.pear.qa (#3904) next »