cvs: peardoc /en/chapters standards.xml

From: Date: Sat, 25 Nov 2006 16:57:02 +0000
Subject: cvs: peardoc /en/chapters standards.xml
Groups: php.pear.doc 
Request: Send a blank email to pear-doc+get-8878@lists.php.net to get a copy of this message
cweiske Sat Nov 25 16:57:02 2006 UTC Modified files: /peardoc/en/chapters standards.xml Log: Fixing bug #5814 - Clearify CS - Make coding style recommendations not covered by CS offtopic http://cvs.php.net/viewvc.cgi/peardoc/en/chapters/standards.xml?r1=1.42&r2=1.43&diff_format=u Index: peardoc/en/chapters/standards.xml diff -u peardoc/en/chapters/standards.xml:1.42 peardoc/en/chapters/standards.xml:1.43 --- peardoc/en/chapters/standards.xml:1.42 Tue Aug 1 15:15:39 2006 +++ peardoc/en/chapters/standards.xml Sat Nov 25 16:57:02 2006 @@ -1,22 +1,26 @@ <?xml version="1.0" encoding="iso-8859-1" ?> -<!-- $Revision: 1.42 $ --> +<!-- $Revision: 1.43 $ --> <chapter id="standards"> <title>Coding Standards</title> <note> <simpara> The PEAR Coding Standards apply to code that is part of the official - PEAR distribution (that is, either distributed with PHP or available - for download from the PHP PEAR repository). + PEAR distribution. Coding standards often abbreviated as CS among + developers and they aim to keep code consistent to be easily readable + and maintainable by most of PEAR folks. </simpara> </note> <sect1 id="standards.indenting"> <title>Indenting and Line Length</title> <para> - Use an indent of 4 spaces, with no tabs. If you use Emacs to edit PEAR - code, you should set indent-tabs-mode to nil. Here is an example mode - hook that will set up Emacs according to these guidelines (you will - need to ensure that it is called when you are editing PHP files): + Use an indent of 4 spaces, with no tabs. This helps to avoid problems + with diffs, patches, CVS history and annotations. + </para> + <para> + For Emacs you should set indent-tabs-mode to nil. Here is an example + mode hook that will set up Emacs (ensure that it is called when you + are editing PHP files): <programlisting role="elisp"> <![CDATA[ (defun php-mode-hook () @@ -30,7 +34,7 @@ ]]> </programlisting> </para> - <para>Here are vim rules for the same thing: + <para>Here are Vim rules for the same thing: <programlisting role="vim"> <![CDATA[ set expandtab @@ -41,11 +45,8 @@ </programlisting> </para> <para> - It is recommended that you break lines at approximately 75-85 characters. - There is no standard rule for the best way to break a line, use your - judgment and, when in doubt, ask on the <ulink - url="mailto:&email.pear.qa;">PEAR Quality Assurance mailing - list</ulink>. + It is recommended to keep lines at approximately 75-85 characters long + for better code readability. </para> </sect1> @@ -565,9 +566,7 @@ This section applies only to packages using CVS at cvs.php.net. </simpara> <para> - Include the &dollar;Id&dollar; CVS keyword in each file. As each file - is edited, add this tag if it's not yet present (or replace - existing forms such as <quote>Last Modified:</quote>, etc.). + Include the &dollar;Id&dollar; CVS keyword in each file. <!-- <note> <simpara> @@ -827,6 +826,20 @@ </para> </sect1> + <sect1 id="standards.bestpractices"> + <title>Best practices</title> + <para> + There are other things not covered by PEAR Coding Standards which + are mostly subject of personal preference and not directly related + to readability of the code. Things like "single quotes vs double + quotes" are features of PHP itself to make programming easier and + there no reasons not use one way in preference to another. Such + best practices are left solely on developer to decide. The only + recommendation could be made to keep consistency within package + and respect personal style of other developers. + </para> + </sect1> + <sect1 id="standards.sample"> <title>Sample File (including Docblock Comment standards)</title> <para>

« previous php.pear.doc (#8878) next »