Wednesday, March 16, 2011

multiple subpackages for phpdoc

Is it possible to have a file belong to multiple subpackages? For example:

/**
 * Name
 *
 * Desc
 *
 * @package    Core
 * @subpackage  Sub1
 * @subpackage  Sub2
 */

Thanks!

From stackoverflow
  • It appears that PHPDoc does not allow you to do it for namespacing reasons. From the PHPDoc Docs:

    NOTE: The @subpackage tag is intended to help categorize the elements that are in an actual @package value. Since PHP itself doesn't allow you to have two functions with the same name in the same script, PhpDocumentor also requires all names in an @package to be unique... meaning, @subpackage does not allow further "naming separation" inside that @package. What it does do is allow a level of visual grouping/separation of the elements inside that @package.

    It seems that because PHPDoc's @package is a way to pseudo-namespace your functions and classes, but @subpackage is simply for categorization. Have you tried adding more than one subpackage? If so, what were the results?

    Eric Lamb : Yeah, I tried it and it didn't work. I was hoping I was just doing it wrong :) Oh Well.
    localshred : Sorry to be a bummer. Hope this helped.
  • http://pear.php.net/package/PHP_UML/

    Seems to do a pretty good job with multiple @subpackage tags - it will even generate html- documentation just as phpDocumentor does - though it doesn't seem to be as style-able as phpDocumentor.

    It also makes use of the extra subpackage by showing it in the generated UML diagaram.

0 comments:

Post a Comment