PhpDocs: is it possible to bind a method in a parameter description?

Is it possible to bind another method / class / property / etc. inside my project inside the tag @deprecated? Like this:

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

...

?

+11
source share
1 answer

According to PHPdoc.org, you can use the @see tag for this .

 /**
 * @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()
{
     <...>
}

In addition, PHPdoc.org recommends using @see in the case of the @deprecated method :

It is RECOMMENDED (but not required) to provide an additional description indicating why the related item is out of date. If it is replaced by another method, it is RECOMMENDED to add the @see tag in the same PHPDoc pointing to the new element.

+12

Source: https://habr.com/ru/post/1664692/


All Articles