How can I use @var for a function variable?

I have a $ user variable that is of the User data type (class).

I have a class method, so I can't just type:

/**
 * @var User
 */
$user = Factory::getInstance('User');

      

because this will only work with class properties, not variables like this.

how can I tell netbeans that this variable is of the User datatype in the method?

Thanks!

+2


a source to share


1 answer


From this answer, you can do this:



$user = Factory::getInstance('User');
/* @var $user User */

//netbeans should now autocomplete $user->

      

+1


a source







All Articles