Re: Coding Standards: Syntax and identation

From: Date: Sun, 03 Dec 2000 11:24:46 +0000
Subject: Re: Coding Standards: Syntax and identation
References: 1  Groups: php.pear 
Request: Send a blank email to php-pear+get-477@lists.php.net to get a copy of this message
Sterling Hughes wrote: > ><[4] When indenting, use the tab character. A tab is expected to > >represent > >< four spaces. It is important to maintain consistency in indenture > >so > >< that definitions, comments, and control structures line up > >correctly. > > > >I used tabs with a width of 2 spaces in PHPDoc, was that a good idea? > > Nooooooooooo!!!!!!!!!!!!!!!!! ;) |-). That's why I'm asking for Coding Standards. It's a neverending dispute - tab or space. Spaces are good for those guys that don't use editors. Every editor allows you to specify the tab size and it's much easier to reformat tabbed source. Formatting is the reason why tabs got invented. And tabs save disk space... By the way. Even core PEAR files like PEAR.php use a wild mixture of spaces and tabs. We need a rule on this issue. > Also the CODING_STANDARDS file is pretty much meant only for C code, not PHP > code. But it could be used for PHP as well, there's not much you can't apply to PHP code. Even if you don't like it it's a good starting point for a PEAR Coding Standards. > Check out http://pear.php.net/doc/pear.html for more > information regarding > PEAR code... (not complete yet) I know that file since a very long time. The file does not say anything about indentation, spaces around operators, braces, abstract methods, final slots (read-only class variables)... Here's again what I would like to see: indentation: tabs must be used (tabsize is 2/4 spaces) (As said I like 2 spaces) spaces around operators: strongly recommended braces: BSD Style abstract methods: return PEAR_Error("Call to abstract method."); final class variables: var $PI = 4; (uppercase names like for constants) > > -Sterling > > -- > PHP Extension and Add-on Repository (PEAR) mailing list. > Documentation can be found at http://pear.php.net/doc/pear.html > To unsubscribe, e-mail: php-pear-unsubscribe@lists.php.net from the > mail address you subscribed with. > > -- > PHP Extension and Add-on Repository (PEAR) mailing list. > Documentation can be found at http://pear.php.net/doc/pear.html > To unsubscribe, e-mail: php-pear-unsubscribe@lists.php.net from the > mail address you subscribed with.

« previous php.pear (#477) next »