2016-12-23 37 views
3

是否可以链接到另一个方法/类/属性/等。在我的项目里面内嵌@deprecated标签?像这样:PhpDocs:可能链接参数描述中的方法?

/** 
* 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... 
} 

... 

+0

您可以使用[@see](https://www.phpdoc.org/docs/latest/references/phpdoc/tags/see.html)标记 – Dragos

回答

2

根据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标记。