문제

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top