user212218
user212218

Reputation:

How to tell IDE to type hint a class/instance property correctly?

When declaring a class/instance property, I am accustomed to doing something like this:

class MyClass
{
  protected
    /** @var SplDoublyLinkedList */
    $_nodes;
}

In the example above, I would expect my IDE (PhpStorm in my case) to show me code completion for the SplDoublyLinkedList class any time I typed $this->_nodes-> anywhere inside the class declaration.

This doesn't appear to be occurring, though. Is this a a problem with PhpStorm, or am I just not doing it right?

EDIT: I've submitted a feature request on YouTrack.

Upvotes: 0

Views: 1298

Answers (1)

RiaD
RiaD

Reputation: 47658

try

 class MyClass
{
   /** @var SplDoublyLinkedList */
   protected
   $_nodes;
}

Upvotes: 3

Related Questions