【问题标题】:PhpDocs: Link to another method in "@param" tag's description?PhpDocs:链接到“@param”标签描述中的另一个方法?
【发布时间】:2023-02-02 04:01:08
【问题描述】:
是否可以链接到我项目的另一个方法/类/属性/等,在@param 标签内内联?
像这样:
/**
* My method's description.
*
* @param string $myArg Pass here result of {@link myOtherMethod()}.
*
* @return bool
*/
public function myMethod($myArg) {
// TODO: code here.
}
...
【问题讨论】:
标签:
php
documentation
phpdoc
phpdocumentor2
【解决方案1】:
PhpDoc (phpDocumentor) 和doxygen 都支持内联链接到其他方法。
对于 phpDocumentor:
{@link myOtherMethod()}
对于氧气:
{@link #myOtherMethod}
或者甚至只是:
myOtherMethod()
笔记未编译文档的人类可读性很重要,
因此应该使用phpDocumentor 语法,因为它更广为人知(至少PHP 开发人员)。
但一旦doxygen 支持相同的PhpDoc 语法,使用doxygen 生成文档就没有问题,因为一旦文档被编译,使用什么工具编译它们并不重要,它们都是可读的。