简体   繁体   中英

Add Dynamic @return code hinting in Netbeans php

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM