PhpDocs: Link to another method in "@param" tag's description?
Asked Answered
B

1

0

Is it possible to link to another method/class/property/etc of my project, inline inside the @param tag?

Like this:

/**
 * My method's description.
 *
 * @param string $myArg Pass here result of {@link myOtherMethod()}.
 *
 * @return bool
 */
public function myMethod($myArg) {
    // TODO: code here.
}

...
Burgoyne answered 1/2, 2023 at 19:45 Comment(0)
B
0

Both PhpDoc (phpDocumentor) and doxygen support inline-link to other method.

For phpDocumentor

Use:

{@link myOtherMethod()}

Or:

{@link MyClass::myOtherMethod()}

But unlike doxygen, seems inline-link is not everywhere supported, see PhpDocs: Link to another method in "@deprecated" tag's description?

For doxygen:

{@link #myOtherMethod}

Or:

{@link MyClass#myOtherMethod}

Or even just:

myOtherMethod()

Note that human-readability of un-compiled docs matters, hence phpDocumentor syntax should be used, because it's more known (by PHP developers at least).

But once doxygen supports that same PhpDoc syntax, it's no issue to generate docs with doxygen, because once docs are compiled, it does not matter with what tool they were compiled, they are readable either way.

Burgoyne answered 1/2, 2023 at 19:45 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.