For Programmers: Free Programming Magazines  


Home > Archive > PHP PEAR Questions and Answers > August 2006 > Re: [PEAR-QA] 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 Re: [PEAR-QA] Coding Standards
Alan Knowles

2006-08-24, 3:58 am

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

Sponsored Links







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

Copyright 2008 codecomments.com