Previous Up Next
@tutorial phpDocumentor tags @var

@uses

Display a link to the documentation for an element, and create a backlink in the other element's documentation to this

Gregory Beaver
Tag Documentation written by [email protected]
Copyright 2002, Gregory Beaver
(phpDocumentor 0.1+)
@uses file.ext|elementname|class::methodname()|class::$variablename|functionname()|function functionname description of how the element is used

Description

Since version 1.2.0beta3, the syntax for @uses has changed. It differs in that @uses now contains a description of how the element is used and does not allow a comma-delimited list of values any longer.

The @uses tag may be used to document any element (global variable, include, page, class, function, define, method, variable)

@uses only displays links to element documentation. If you want to display a hyperlink, use @link or inline {@link}

@uses is very similar to @see, see the documentation for @see for details on format and structure. The @uses tag differs from @see in two ways. @see is a one-way link, meaning the documentation containing a @see tag contains a link to other documentation. The @uses tag automatically creates a virtual @usedby tag in the other documentation that links to the documentation containing the @uses tag. In other words, it is exactly like @see, except a return link is added automatically.

The other difference is that @uses only accepts one element to link to, and a description of that element.

Example

Here's an example of valid @uses syntax:

  1. /**
  2.  * class 1
  3.  * 
  4.  */
  5. class main_class
  6. {
  7.     /**
  8.      * @var integer 
  9.      */
  10.     var foo 3;
  11.  
  12.     /**
  13.      * subclass inherits this method.
  14.      * example of a word which is either a constant or class name,
  15.      * in this case a classname
  16.      * @uses subclass sets a temporary variable
  17.      * @uses subclass::$foo this is compared to TEST_CONST
  18.      * @uses TEST_CONST compared to subclass::$foo, we
  19.      *                   die() if not found
  20.      */
  21.  
  22.     function parent_method()
  23.     {
  24.         if ($this->foo==9die;
  25.         $test new subclass;
  26.         $a $test->foo;
  27.         if ($a == TEST_CONSTdie;
  28.     }
  29. }
  30.  
  31. /**
  32.  * this class extends main_class.
  33.  */
  34. subclass extends main_class
  35. {
  36.     /**
  37.      * @var integer 
  38.      */
  39.     var $foo 9;
  40. }
  41.  
  42. define("TEST_CONST","foobar");

This will parse as if it were:

  1. /**
  2.  * class 1
  3.  * 
  4.  */
  5. class main_class
  6. {
  7.     /**
  8.      * @var integer 
  9.      */
  10.     var foo 3;
  11.  
  12.     /**
  13.      * subclass inherits this method.
  14.      * example of a word which is either a constant or class name,
  15.      * in this case a classname
  16.      * @uses subclass sets a temporary variable
  17.      * @uses subclass::$foo this is compared to TEST_CONST
  18.      * @uses TEST_CONST compared to subclass::$foo, we
  19.      *                   die() if not found
  20.      */
  21.  
  22.     function parent_method()
  23.     {
  24.         if ($this->foo==9die;
  25.         $test new subclass;
  26.         $a $test->foo;
  27.         if ($a == TEST_CONSTdie;
  28.     }
  29. }
  30.  
  31. /**
  32.  * this class extends main_class.
  33.  * @usedby main_class::parent_method() sets a temporary variable
  34.  */
  35. subclass extends main_class
  36. {
  37.     /**
  38.      * @var integer 
  39.      * @usedby main_class::parent_method() this is compared to TEST_CONST
  40.      */
  41.     var $foo 9;
  42. }
  43.  
  44. /**
  45.  * @usedby main_class::parent_method() compared to subclass::$foo, we
  46.  *                                      die() if not found
  47.  */
  48. define("TEST_CONST","foobar");

Previous Up Next
@tutorial phpDocumentor tags @var

Documentation generated on Mon, 05 Dec 2011 20:55:55 -0600 by phpDocumentor 1.4.4