This is a DocComment containing a single PHPDoc and represents the basic in-source representation.
Example:
1 2 3 4 5 | /**
* Returns the name of this object.
*
* @return string
*/
|
phpDocumentor generates an intermediate XML file between parsing your source code and generating the HTML output. This structure file (called structure.xml) contains the raw analyzed data of your project.
This same file is also used by phpDocumentor to do incremental parsing of your project by comparing the contents of this file with the content on disk.
It is thus recommended to keep your structure file and allow phpDocumentor to re-use the contained information.
This is a section of documentation which provides information on several aspects of Structural Elements.
A PHPDoc is usually enveloped in a DocComment.
Example:
1 2 3 | Returns the name of this object.
@return string
|
Example enveloped in a DocComment:
1 2 3 4 5 | /**
* Returns the name of this object.
*
* @return string
*/
|
This is a special type of comment which starts with /**, ends with */ and may contain any number of lines in between. Every line should start with an asterisk, which is aligned with the first asterisk of the opening clause.
Single line example:
1 | /** <...> */
|
Multiline example:
1 2 3 | /**
* <...>
*/
|
This is a collection of Programming Constructs which SHOULD be preceded by a DocBlock. The collection contains the following constructs:
It is RECOMMENDED to precede Structural Elements with a DocBlock at its definition and not with each individual usage.
Example:
1 2 3 4 5 | /** @type int This is a counter. */
$int = 0;
// there should be no docblock here
$int++;
|
Or:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | /**
* This class acts as an example on where to position a DocBlock.
*/
class Foo
{
/** @type string|null Should contain a description if available */
protected $description = null;
/**
* This method sets a description.
*
* @param string $description A text with a maximum of 80 characters.
*
* @return void
*/
public function setDescription($description)
{
// there should be no docblock here
$this->description = $description;
}
}
|
Another example is to document the variable in a foreach explicitly; many IDEs use this information to help you with auto-completion:
1 2 3 4 5 6 | /** @type \Sqlite3 $sqlite */
foreach($connections as $sqlite) {
// there should be no docblock here
$sqlite->open('/my/database/path');
<...>
}
|
This is a generic name for anything that can be returned or provided as identity for a value.
It is recommended to read the chapter Definition of a ‘Type’ for a detailed description.
© Copyright 2011, Mike van Riel. Created using Sphinx 1.0.7.