|
|
|
@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
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:
/**
* class 1
*
*/
class main_class
{
/**
* @var integer
*/
var foo = 3;
/**
* subclass inherits this method.
* example of a word which is either a constant or class name,
* in this case a classname
* @uses subclass sets a temporary variable
* @uses subclass::$foo this is compared to TEST_CONST
* @uses TEST_CONST compared to subclass::$foo, we
* die() if not found
*/
function parent_method()
{
if ($this->foo==9) die;
$test = new subclass;
$a = $test->foo;
if ($a == TEST_CONST) die;
}
}
/**
* this class extends main_class.
*/
subclass extends main_class
{
/**
* @var integer
*/
var $foo = 9;
}
define("TEST_CONST","foobar");
This will parse as if it were:
/**
* class 1
*
*/
class main_class
{
/**
* @var integer
*/
var foo = 3;
/**
* subclass inherits this method.
* example of a word which is either a constant or class name,
* in this case a classname
* @uses subclass sets a temporary variable
* @uses subclass::$foo this is compared to TEST_CONST
* @uses TEST_CONST compared to subclass::$foo, we
* die() if not found
*/
function parent_method()
{
if ($this->foo==9) die;
$test = new subclass;
$a = $test->foo;
if ($a == TEST_CONST) die;
}
}
/**
* this class extends main_class.
* @usedby main_class::parent_method() sets a temporary variable
*/
subclass extends main_class
{
/**
* @var integer
* @usedby main_class::parent_method() this is compared to TEST_CONST
*/
var $foo = 9;
}
/**
* @usedby main_class::parent_method() compared to subclass::$foo, we
* die() if not found
*/
define("TEST_CONST","foobar");
|
|
|
@tutorial
|
phpDocumentor tags
|
@var
|
Documentation generated on Mon, 05 Dec 2011 21:01:53 -0600 by phpDocumentor 1.4.4