Re: Re: Need feedback about PEAR Coding Standard relatedto PHP_CodeSnifferusage
| From: | Chuck Burgess | Date: | Wed, 19 Dec 2007 19:15:12 +0000 |
| Subject: | Re: Re: Need feedback about PEAR Coding Standard relatedto PHP_CodeSnifferusage | ||
| References: | 1 2 3 4 5 6 7 | Groups: | php.pear.qa |
| Request: | Send a blank email to pear-qa+get-4707@lists.php.net to get a copy of this message | ||
On Dec 19, 2007 12:32 PM, Laurent Laville <pear@laurent-laville.org> wrote:
> Sorry , I was a bit to hurry yesterday night.
>
> Parameters was of course for constructor of class declaration :
>
I wasn't meaning that the format of the code would have been incorrect
specifically because of those parameters, though now that you mention it I
guess technically you're right about that. I was meaning that I thought
putting an entire class declaration block inside an IF block was not legal.
So,
if ($flag) {
class A {}
} else {
class A {}
}
is enough to display what I thought wasn't legal. Assuming this *is *legal,
then that concern of mine is put to rest.
Getting back to the original question, I wonder, then, would a future
possibility of phpcs handling docblock templates be enough to allow doing
this for now:
/**#@+
* our declaration of Class A
* @package MyPackage
*/
if ($flag) {
/**
* @internal class as set by a TRUE $flag
*/
class A {}
} else {
/**
* @internal class as set by a FALSE $flag
* @ignore
*/
class A {}
}
/**#@-*/
That helps mitigate the duplication of putting two fully populated docblocks
with each class declaration block. Though again, this means that it will
remain a CS warning/error until such time as we get docblock template
handling into PHPCS.
Now, the @ignore means that the second class structure definition won't be
documented by PhpDocumentor, so no one reading your API doc will know
anything about it, particularly what makes it any different from the first
class structure definition that *is* visible in the API doc. But of course
that is an API doc concern and not a PHPCS concern.
--
CRB