Question

I created a component in Yii on top of the normal CComponent. Yii has a useful but quirky process of using magic functions like __get and __set and __call for read-only/write-only properties and for event functions.

When I create an object from the component and attach event handlers to some event in the object, I forfeit the luxury of using code completion because either that property/method does not exist or is protected and so gets answered by __call/__set/__get().

Any idea on how to trick Netbeans code completion into thinking these methods or properties exist? Also is there a way to add PHPDoc comments onto these fake properties and methods?

No correct solution

OTHER TIPS

I guess I found the answer.

http://www.phpdoc.org/docs/latest/references/phpdoc/tags/property.html

The @property tag is used in the situation where a class contains the __get() and __set() magic methods and allows for specific names.

Also:

The @method tag is used in situation where a class contains the __call() magic method and defines some definite uses.

So to add code completion or auto-completion for pseudo properties/methods you would put PHPDoc syntax.

/** 
 * Someclass class
 * @property [Type] [name] [<description>]
 * @method [return type] [name]([[type] [parameter]<, ...>]) [<description>]
 *
 */
class Someclass {}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top