netbeans autocompletion when using singleton to retrieve object instead of new operator?
- by fayer
when i use the 'new' operator to instantiate a class, netbeans has no problem to autocomplete the members of the object.
$instance = new Singleton();
$instance-> // shows test() method
but when i use a singleton to retrieve an object it cannot autocomplete the members in the object retrieved.
the getInstance code looks like this:
public function test() {
echo "hello";
}
public static function getInstance() {
if ( ! is_object(self::$_instance)) {
self::$_instance = new self();
self::$_instance->initialize();
}
return self::$_instance;
}
so i use:
$instance = Singleton::getInstance();
$instance-> // no autocompletion!
does anyone have the same problem?
how do i work around it?
thanks!