【问题标题】:PhpDocs: Possible to link method in parameter description?PhpDocs:可以在参数描述中链接方法吗?
【发布时间】:2017-05-09 06:27:48
【问题描述】:

是否可以链接到另一个方法/类/属性/等。在@deprecated 标签内的我的项目内联?像这样:

/**
 * Method description
 * @deprecated 1.0 Reason for deprecation, use {@link newMethod()} instead!
 * @param string $str
 * @param string|null $str2
 * @return bool
*/
public function method($str, $str2) {
    // TODO: Code...
}

...

?

【问题讨论】:

  • 你可以使用@see标签

标签: php documentation phpdoc phpdocumentor2


【解决方案1】:

根据 PHPdoc.org,您可以使用 @see 标记。

 /**
 * @see http://example.com/my/bar Documentation of Foo.
 * @see MyClass::$items           For the property whose items are counted.
 * @see MyClass::setItems()       To set the items for this collection.
 *
 * @return integer Indicates the number of items.
 */
function count()
{
     <...>
}

另外,PHPdoc.org recommends to use @see in case of a @deprecated method:

建议(但不是必需)提供附加说明,说明不推荐使用关联元素的原因。如果它被其他方法取代,建议在指向新元素的同一 PHPDoc 中添加 @see 标记。

【讨论】:

    猜你喜欢
    • 2023-02-02
    • 2020-10-14
    • 2019-09-11
    • 1970-01-01
    • 2017-03-31
    • 2021-01-15
    • 1970-01-01
    • 1970-01-01
    • 2023-03-25
    相关资源
    最近更新 更多