3

What I want is that when I declare a magic method with @method PHPDoc, can i use @see so that the magic method has the same PHPDoc as the method pointed via @see

Here is the code of what I have tried. But IDE did not recognize it. I am using Netbeans 7.3.1.

/**
* @method string my_method() @see _my_method()
*/
class Foo {
  public __call($name, $args) {
     $name = "_".$name;
     $this->$name($args);
  }

  /**
  * @return String
  */
  protected _my_method() {
     return "bar";
  }
}
2
  • Please clarify "did not work" (what did happen?) Commented May 30, 2014 at 7:53
  • Have updated the question, does that explain better? Commented May 30, 2014 at 12:09

2 Answers 2

2

The exact parsing will depend on which IDE you're using, but the PHPDocumentor documentation for @see shows a couple of differences from your usage:

  • The @see tag is on its own line, not appended to the line before. @link has a separate "inline" syntax if you want to include a cross-reference inside a description ({@link http://example.com/my/bar}).
  • The "target" should be a fully qualified element name, not just the local method name, e.g. @see Foo::_my_method()

There is also a draft PSR to standardise the behaviour, with similar requirements.

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

2 Comments

Ya such usage of @see works fine with normal functions but not with magic methods
0

I would like to create links to "other" methods to, and I tried @see, @link and lots of other stuff, without any helpfull results.

In phpstorm everything is yust displayed as text.

BUT:

I discovered, that you can write own html-code, so e.g.

/**
* @method string my_method() see <a href="http://my-documentation/my_method()">_my_method()</a>
*/
class Foo {
}

would work to create links on external pages. Unfortunally it only works for external links, and not for links to methods in your editor.

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.