[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: PHP Coding Standards -- Automatic checkers -- Automatic phpDocumento
From: |
Davi Leal |
Subject: |
Re: PHP Coding Standards -- Automatic checkers -- Automatic phpDocumentor |
Date: |
Wed, 11 Apr 2007 20:11:59 +0200 |
User-agent: |
KMail/1.9.5 |
Victor Engmark wrote:
> Davi Leal wrote:
> > Do you know some standard which we could link to, and try to follow to
> > write our code?.
Obviously, I think we should analyze all the available options, to choose
the best one:
===========================================
Option -1- --------------------------------
If it is possible, we should choose some coding standard which be PHP
specific, due to PHP has some specific syntax contructions, for example:
<?php
$foo = $bar[example]; // Wrong: what happens if 'example' is
defined as a constant elsewhere?
$foo = $bar['example']; // Correct: no ambiguity as to the
?> // name of the key
Ref.: http://www.evolt.org/article/PHP_coding_guidelines/18/60247/
Cons:
* It is an article about a guide, no a Coding Standard itself.
===========================================
Option -2- --------------------------------
> There's the Java coding conventions <http://java.sun.com/docs/codeconv/>,
> which are pretty applicable anywhere.
> I seem to remember some software from
> years ago which would tidy your code according to those conventions.
Automatic conversion could be cool!. Such kind of tool could be used to
process our current code.
Cons:
* It is not specific for PHP.
===========================================
Option or as extra Authority to the chosen
option? -3- -------------------------------
> The Pragmatic Programmer <http://www.pragmaticprogrammer.com/ppbook/> has
> many good tips, such as "Don't repeat yourself" (IIRC, the first and most
> important tip) and "Write the tests first". They are just guidelines, but
> could possibly be used as the authority when disputing some practice. Oh
> yeah, and I think one advice is to have a clear coding convention :)
Due to this is not specific for PHP, should we take it as one of the option to
choose or just as an 'authority' when disputing some practice, as you say?.
Cons:
* It is not specific for PHP.
===========================================
Option -4- --------------------------------
PEAR has released recently "PHP_CodeSniffer". It is an automatic tool, a Code
Standard helper. Is it the best option we have now?.
Ref.:
http://www.phpkitchen.com/index.php?/archives/757-PHP-Coding-Standards-Laying-Down-the-Law.html
Pros:
* It is an automatic tool.
===========================================
Option -5- --------------------------------
PHP::PEAR Coding Standards
http://pear.php.net/manual/en/standards.php
Ref. from: http://pear.php.net/manual/en/standards.php
There are rules to add to "emacs" and "vim".
===========================================
Another subject which we could take into account is the automatic generation
of documentation.
The phpDocumentor package provides automatic documenting of PHP code API
directly from the source.
Ref.: http://pear.php.net/manual/en/package.php.phpdocumentor.intro.php
Davi