Previous Up Next
@staticvar phpDocumentor tags @todo

@subpackage

Specify sub-package to group classes or functions and defines into. Requires @package tag

Gregory Beaver
Tag Documentation written by [email protected]
Copyright 2002, Gregory Beaver
(phpDocumentor 0.1+)
@subpackage subpackagename

Description

@subpackage works with @package to group php files together for documentation.

If found in a page-level DocBlock, specifies the sub-package that all functions and defines in the php file belong to. If found in a class-level DocBlock, specifies the sub-package that the class belongs to.

If @package is not present in the same DocBlock, the @subpackage tag is ignored. A SUBPACKAGE NAME MUST BE ONE WORD WITH NO SPACES OR NEWLINES CONTAINING ONLY LETTERS, DIGITS, and "_", "-", "[" or "]"

A @subpackage tag is applied to documented elements in the same way that @package is applied.

If a file contains functions and defines, they will be packaged by a page-level DocBlock. A page-level DocBlock is a DocBlock that is not paired with any phpDocumentor element (include, function, define, class, class function, class variable).

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.

Example

phpDocumentor parses a DocBlock as a page-level DocBlock if it precedes another DocBlock like this:

  1. /**
  2.  * Page-Level DocBlock example.
  3.  * This DocBlock precedes another DocBlock and will be parsed as the page-level.
  4.  * Put your @package and @subpackage tags here
  5.  * @package pagelevel_package
  6.  * @subpackage data
  7.  */
  8. /**
  9.  * function datafunction
  10.  */
  11. function datafunction()
  12. {
  13. ...
  14. }

A class-level DocBlock is any DocBlock that precedes a class definition in a php file.

  1. <?php
  2. /**
  3.  * class bluh
  4.  * class-level DocBlock example.
  5.  * @package applies_to_bluh
  6.  * @subpackage bluh
  7.  */
  8. class bluh
  9. {
  10.    /**
  11.     * This variable is parsed as part of package applies_to_bluh, and subpackage bluh
  12.     */
  13.    var $foo;
  14.     
  15.    /**
  16.     * So is this function
  17.     */
  18.    function bar()
  19.    {
  20.    }}
  21. ?>

See also: @package

Previous Up Next
@staticvar phpDocumentor tags @todo

Documentation generated on Mon, 05 Dec 2011 21:13:05 -0600 by phpDocumentor 1.4.4