PhpDocs:可以在参数描述中使用 link 方法吗?
PhpDocs: Possible to link method in parameter description?
是否可以link到另一个method/class/property/etc。在我的项目内联 @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...
}
...
?
根据 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:
It is RECOMMENDED (but not required) to provide an additional description stating why the associated element is deprecated. If it is superceded by another method it is RECOMMENDED to add a @see tag in the same PHPDoc pointing to the new element.
是否可以link到另一个method/class/property/etc。在我的项目内联 @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...
}
...
?
根据 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:
It is RECOMMENDED (but not required) to provide an additional description stating why the associated element is deprecated. If it is superceded by another method it is RECOMMENDED to add a @see tag in the same PHPDoc pointing to the new element.