17

是否可以链接到另一个方法/类/属性/等。在我的项目内内联@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...
}

...

?

4

1 回答 1

22

根据 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 建议在 @deprecated 方法的情况下使用 @see

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

于 2016-12-23T14:38:52.553 回答