|
|
|
@property
|
phpDocumentor tags
|
@see
|
@return
Specify the return type of a function or method
Gregory Beaver
Copyright 2002, Gregory Beaver
(phpDocumentor 0.1+)
@return
datatype
description
@return
datatype1|datatype2
description
Description
The @return tag is used to document the return value of functions or methods. @returns is an alias for @return to support tag formats of other automatic documentors
The datatype should be a valid PHP type (int, string, bool, etc), a class name for the type of object returned, or simply "mixed". If you want to explicitly show multiple possible return types, list them pipe-delimited without spaces (e.g. "@return int|string"). If a class name is used as the datatype in the @return tag, phpDocumentor will automatically create a link to that class's documentation. In addition, if a function returns multiple possible values, separate them using the | character, and phpDocumentor will parse out any class names in the return value. phpDocumentor will display the optional description unmodified.
Example
Here's an example:
/**
* example of basic @return usage
* @return mixed
*/
function function1($baz)
{
if ($baz)
{
$a = 5;
} else
{
$a = array(1,4);
}
return $a;
}
/**
* example of showing multiple possible return types
* @return int|string could be an int, could be a string
*/
function function2($foo)
{
if ($foo)
{
return 0;
}
else
{
return "zero";
}
}
class class1
{
/**
* example of documenting a method, and using optional description with @return
* @return string de-html_entitied string (no entities at all)
*/
function bar($foo)
{
}
/**
* example of using @return with a class name
* @param integer even or odd integer
* @return Parser|false phpDocumentor Parser object or error
*/
function &factory($number)
{
$returnval = true;
if ($number % 2)
{
} else
{
$returnval = false;
}
return $returnval;
}
}
|
|
|
@property
|
phpDocumentor tags
|
@see
|
Documentation generated on Mon, 05 Dec 2011 21:35:24 -0600 by phpDocumentor 1.4.4