1

I use PHPDoc to enhance PhpStorm hinting. Normally, a method would have a PHPDoc like this:

/**
 * @param array|callable $a
 * @param int $b
 * @return mixed
 */
public function x($a, $b) {
    // …
}

I need to describe the same inside a @method tag. PhpStorm (or PHPDoc) doesn't like the vertical bar. If I take it out with one of the types – everything looks good.

/**
 * @method mixed x(array|callable $a, int $b)
 */
class A {
    // …
}

First, is this a legal syntax for @method tag and the problem is with PhpStorm? If not, is there a way to describe arguments in full inside @method? Thanks!

1 Answer 1

3

It's not yet supported, just like specifying arrays of types using the bracket syntax.

http://youtrack.jetbrains.com/issue/WI-22571

I'm not aware of any workaround for this, other than using mixed (which isn't really a workaround).

I'd suggest to comment and vote in the tracker.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.