php - How can I use docblock hints with classes for $this variables? -



php - How can I use docblock hints with classes for $this variables? -

i'm using netbeans ide. whenever have code uses function (usually factory) homecoming object, typically can next help hinting:

/* @var $object fooclass */ $object = $somefunction->get('barcontext.fooclass'); $object-> // produce property , function hints fooclass.

however, when utilize object's property store class, i'm @ bit of loss how same, trying utilize @var $this->foo or @var foo not carry hinting through:

use path\to\fooclass; class bar { protected $foo; public function bat() { $this->foo = factoryclass::get('foo'); // returns instance of fooclass $this->foo //does not have hinting in ide } }

i have tried in docblock class, or using inline comments above protected $foo or foo set instance.

the workaround have found far to:

public function bat() { $this->foo = factoryclass::get('foo'); /* @var $extravariable fooclass */ $extravariable = $this->foo; $extravariable-> // has hinting. }

i have hinting class-wide though, many other functions potentially utilize $this->foo, , knowing class's methods , properties useful.

surely there more straightforward way...

i cannot how works in netbeans, in phpeclipse, add together hint declaration of variable itself:

use path\to\fooclass; class bar { /** * @var fooclass */ protected $foo; public function bat() { $this->foo = factoryclass::get('foo'); // returns instance of fooclass $this->foo // should have hinting } }

php netbeans code-hinting docblocks

Comments

Popular posts from this blog

How do I check if an insert was successful with MySQLdb in Python? -

delphi - blogger via idHTTP : error 400 bad request -

postgresql - ERROR: operator is not unique: unknown + unknown -