Coding Standards

From: Date: Thu, 24 Aug 2006 05:40:49 +0000
Subject: Coding Standards
Groups: php.pear.qa 
Request: Send a blank email to pear-qa+get-3903@lists.php.net to get a copy of this message
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. * 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. * 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. Thanks, Darren.

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