For Programmers: Free Programming Magazines  


Home > Archive > PHP PEAR Questions and Answers > August 2006 > Coding Standards









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Coding Standards
Darren McKee

2006-08-24, 3:58 am

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.
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com