Registry::get('object') autocomplete

Hello,

$object = Registry::get('object');

/**

* @var MyObject $object

**/

$object->autocompleted_method()

in this way - autocomplete works perfectly because we're saying (using phpdoc) that $object is instance of MyObject.

Is it possible to make PhpStorm autocomplete Registry::get('object')->autocompleted_method()  ?
Maybe it is possible to set some settings helping phpStorm recognize that Registry::get('object') will always return MyObject?

Where can I read about autocomplete tricks in phpStorm?

Thank you!

0

Hi Kirill,

No, it is not possible to achieve such thing with PHPDoc comment only -- there has to be some help from the actual IDE or plugin (which will analyze the calling params and make decision on returned type based on additionally provided info/resolution tables).

You will be interested in watching this ticket: http://youtrack.jetbrains.com/issue/WI-6027

0

请先登录再写评论。