PHPDoc: Difference between revisions
m Add return type to code example |
Categories: Source code documentation formats, PHP |
||
Line 1: | Line 1: | ||
{{short description|Documentation |
{{short description|Documentation format for PHP based on Javadoc}} |
||
{{For|documentation generator|phpDocumentor}} |
|||
'''PHPDoc''' is an adaptation of [[Javadoc]] for the [[PHP]] [[programming language]]. It is still an informal standard for [[Comment (computer programming)|commenting]] PHP code, but it is in the process of being formalized.<ref name="psr">PHP-FIG: PSR Working Draft - https://github.com/php-fig/fig-standards/blob/master/proposed/phpdoc.md</ref> It allows external document generators like [[phpDocumentor]], which is the de facto standard implementation,<ref name="psr"/> to generate documentation of [[Application programming interface|APIs]] and helps some [[Integrated development environment|IDEs]] such as [[Zend Studio]], [[NetBeans]], [[PhpStorm|JetBrains PhpStorm]], [[ActiveState Komodo|ActiveState Komodo Edit and IDE]], [[PHPEdit]] and [[Aptana|Aptana Studio]] to interpret variable types and other ambiguities in the [[Typed and untyped languages|loosely typed language]] and to provide improved [[autocomplete|code completion]], type hinting and debugging. |
'''PHPDoc''' is an adaptation of [[Javadoc]] format for the [[PHP]] [[programming language]]. It is still an informal standard for [[Comment (computer programming)|commenting]] PHP code, but it is in the process of being formalized.<ref name="psr">PHP-FIG: PSR Working Draft - https://github.com/php-fig/fig-standards/blob/master/proposed/phpdoc.md</ref> It allows external document generators like [[phpDocumentor]], which is the de facto standard implementation,<ref name="psr"/> to generate documentation of [[Application programming interface|APIs]] and helps some [[Integrated development environment|IDEs]] such as [[Zend Studio]], [[NetBeans]], [[PhpStorm|JetBrains PhpStorm]], [[ActiveState Komodo|ActiveState Komodo Edit and IDE]], [[PHPEdit]] and [[Aptana|Aptana Studio]] to interpret variable types and other ambiguities in the [[Typed and untyped languages|loosely typed language]] and to provide improved [[autocomplete|code completion]], type hinting and debugging. |
||
PHPDoc supports documentation of both [[object-oriented]] and [[procedural programming|procedural]] code. |
PHPDoc supports documentation of both [[object-oriented]] and [[procedural programming|procedural]] code. |
||
Line 33: | Line 34: | ||
* [http://www.phpdoc.org phpDocumentor.org] |
* [http://www.phpdoc.org phpDocumentor.org] |
||
[[Category: |
[[Category:Source code documentation formats]] |
||
[[Category:PHP |
[[Category:PHP]] |
Revision as of 12:38, 28 December 2023
PHPDoc is an adaptation of Javadoc format for the PHP programming language. It is still an informal standard for commenting PHP code, but it is in the process of being formalized.[1] It allows external document generators like phpDocumentor, which is the de facto standard implementation,[1] to generate documentation of APIs and helps some IDEs such as Zend Studio, NetBeans, JetBrains PhpStorm, ActiveState Komodo Edit and IDE, PHPEdit and Aptana Studio to interpret variable types and other ambiguities in the loosely typed language and to provide improved code completion, type hinting and debugging.
PHPDoc supports documentation of both object-oriented and procedural code.
On August 13, 2013 the PHP Framework Interoperability Group began writing a formal specification (PSR) for PHPDoc.[1]
Example
/**
* Get all image nodes.
*
* @param \DOMNode $node The \DOMDocument instance
* @param boolean $strict If the document has to be valid
*
* @return \DOMNode
*/
public function getImageNodes(\DOMNode $node, $strict = true): \DOMNode
{
// ...
}
See also
References
- ^ a b c PHP-FIG: PSR Working Draft - https://github.com/php-fig/fig-standards/blob/master/proposed/phpdoc.md