Frage

I have a class (which I'll call Example) which implements the __call() method. This method allows the class to be extended to have additional calls (based on other data). For this question, I'll assume one of those is getDemoData().

This getDemoData() function would be available if it had a value in an array with a key Demo. The return value would be a specific class, in this case, named Demo.

Is it possible to some how extend the PHPDoc documentation (either due to PHPDoc directly, or something special in PHPStorm itself) which would allow me to say in Demo that Example has a method named Example::getDemoData().

I know I can use the @method tag from within the class itself, but I don't know if I can use it outside of that class (if I can, I'm not sure the syntax).

Thanks.

War es hilfreich?

Lösung

I think the best you can do in that scenario is to use the @see tag in Demo's class docblock:

/**
 * @see Example::getDemoData()
 */
class Demo {}

assuming that you did indeed put @method in Example's class docblock:

/**
 * @method Demo getDemoData()
 */
class Example {}
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top