Jaroslav Klimčík
Jaroslav Klimčík

Reputation: 4838

PhpStorm - return type hinting in quick documentation

I really like PhpStorm and its document generator according phpDoc. Now I struggle with return type hinting in quick documentation. For example I have this code:

$import_type = $this->importContainer->getType()->getSelectedSchema();

and in ImportContainer class I have this getType method:

/**
 * @return \Easyk\inout\InOutImportType
 */
public function getType() {
    return $this->type;
}

Everything works well but when I want to use PhpStorm's quick documentation I will see this:

quick documentation

And there is not any return value, what should be \Easyk\inout\InOutImportType from return type hinting. I found that if I have this type hinting:

/**
 * @return \Easyk\inout\InOutImportType $importType
 */

then I will see return value:

enter image description here

According phpDoc documentation in @return syntax is description optional so why should I have to describe return value to see it in quick documentation? For me it would be best just see in quick documentation exact return type hinting - without description. I didn't find any option in PhpStorm to enable it, is there any workaround or I miss something and doing it wrong?

I'm using PhpStorm 2017.1.4

Upvotes: 0

Views: 1437

Answers (1)

LazyOne
LazyOne

Reputation: 165471

... or I miss something and doing it wrong?

No -- it works fine already.

And there is not any return value, what should be \Easyk\inout\InOutImportType from return type hinting.

It's there -- check again (hint: check the 1st line there -- function signature/declaration).


What you see in "Returns" section is the optional (as you have noticed yourself) description/explanation of the return value (e.g. "Returns number of items or FALSE on error").

The actual return types are listed at the end of the function signature in first line.

Upvotes: 4

Related Questions