Take the 2-minute tour ×

I have got the following class:

 * @method MyObject a()
class MyClass {
     * @return MyObject
    public static function __callStatic($name, $arguments = NULL)
        return new MyObject($name);

On Netbeans when I write MyClass::a() I will get code completion on MyObject. However, this only works thanks to the @method MyObject a() comment on the class. But my __callStatic() method handles every possible method name. I would like to be able to write MyClass::something() and then get code completion on the MyObject. Is there any way to get that code completion without listing every possible method name in the PHPDoc? Is there some kind of place holder like *()?

Side question: How does Eclipse handle this situation?

share|improve this question
add comment

1 Answer

up vote 5 down vote accepted

No, there is not. You have to add a @method tag for every name. Same thing goes with __get() and the @property tag. This is true as of Netbeans 7.0.1. Eclipse 3.7 (Indigo) with PDT works the same way and requires @method tags in this situation as well.

share|improve this answer
in Eclipse 3.7 +PDT the @method tag doesn't provide code-completion for static methods –  jlb Nov 25 '11 at 11:47
Thanks for your answer, sad that there was no other. I'll probably use a workaround function which just returns the new object instead until there is a real solution. Also, I created an enhancement request on the Netbeans bug repository. Interested users are welcome to vote to increase its priority :) –  str Nov 25 '11 at 16:17
add comment

Your Answer


