Question

I have a ->load() method that includes and returns given class name. So it can return different data types. Can I enable any kind of code hinting in netbeans?

$msg = $this->load('message');
$msg-> // hinting should list message class methods

$usr = $this->load('user');
$usr-> // hinting should list user class methods
Was it helpful?

Solution

Similar question has been answered here: Dynamic return type with type hint in PHP?

any kind of code hinting

Yes, try this.

$usr = $this->load('user');/* @var $usr user */

You may wanna use shortcut "vdoc" and press {tab} in the code to generate the type-hinting comment.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top