Re: Coding Standards: Syntax and identation
| From: | Chuck Hagenbuch | Date: | Sat, 02 Dec 2000 22:34:44 +0000 |
| Subject: | Re: Coding Standards: Syntax and identation | ||
| References: | 1 | Groups: | php.pear |
| Request: | Send a blank email to php-pear+get-472@lists.php.net to get a copy of this message | ||
Quoting Ulf Wendel <ulf.wendel@phpdoc.de>:
> does PEAR overtake the PHP Coding Standards when it comes to syntax and
> identation?
I'd guess that the php coding standards, being meant for C, aren't going to
apply to PEAR most of the time...
> That means I should use this style, right?
>
> /* one line comment */
>
> /*
> multi
> line
> comment
> */
I prefer:
/* multi
* line
* comment
*/
But everyone seems to vary, the the PHPDoc-style comments are slightly
different, as well...
> Is that a must if it comes to curly braces? I preferr the BSD style
> instead of the K&R one. This is K&R:
I'd say that as long as every class is consistent in terms of which style it
uses (ie, every file), we don't really need to mandate something like this.
> Hmm, what about:
>
> if ($foo)
> bar();
Fine. (IMHO, of course - I hope it's understood that this is all opinion aimed
at generating discussion and then consensus).
> < Keep one empty line between the variable decleration section and
>
> Is there any rule on this for PHP code.
It sounds reasonable, for cases where you _have_ a declaration section in php...
> How about operators. Do I have to insert spaces around an operator such
> as: print $bar + $foo;
I would say please do, for readability.
> I used tabs with a width of 2 spaces in PHPDoc, was that a good idea?
*shrug* Like with indenting style, I don't think it's going to be important (or
eventually, possible) to get this consistent across every single file... I use 4
spaces; tab set to 4 spaces is also fine by me.
-chuck
--
Charles Hagenbuch, <chuck@horde.org>
"If you can't stand the heat, get out of the chicken!" - Baby Blues