Re: Re: Need feedback about PEAR Coding Standard relatedto PHP_CodeSnifferusage

From: Date: Wed, 19 Dec 2007 18:32:45 +0000
Subject: Re: Re: Need feedback about PEAR Coding Standard relatedto PHP_CodeSnifferusage
References: 1 2 3 4 5 6  Groups: php.pear.qa 
Request: Send a blank email to pear-qa+get-4706@lists.php.net to get a copy of this message
Chuck Burgess a écrit :
On Dec 18, 2007 5:35 PM, Laurent Laville <pear@laurent-laville.org> wrote:
if (blah) {
        /**
         * @param int $p1
         * @param int $p2
         */
       class A ($p1, $p2) {}
} else {
       /**
         * @param int $p1
         * @param int $p2
         * @ignore
         */
       class A ($p1, $p2) {}
}
I've never seen a class declaration like that... I didn't think PHP would allow it. The way I've seen such a situation like this handled before was to use an IF conditional around an INCLUDE statement, where TRUE would include file A and FALSE would instead include file B. If I had to document that piece of code above, I'd probably attempt to use a docblock template before the IF, containing nearly all the class info, and only put minimal *different* info in the two class-adjacent docblocks, and be satisfied until such time as we can help get docblock template support into phpcs.
Sorry , I was a bit to hurry yesterday night. Parameters was of course for constructor of class declaration : if (blah) {
         /**
          * Class A comment
          *
          * @category   xxx
          * @package    xxx_yyyy
          * @author     name <email>
          * @license    url
          * @link       url
          */
        class A {
            /**
             * @param int $p1
             * @param int $p2
             */
            function __construct($p1, $p2) {}
        }
} else {
        /**
          * @ignore
          */
        class A {
            /**
             * @param int $p1
             * @param int $p2
             */
            function __construct($p1, $p2) {}
        }
} With this code, phpcs, will ask AGAIN the same phpdoc tags (@category, @package, ...) for class A , and class A ignored . This is something like that, why I think its too much.

« previous php.pear.qa (#4706) next »