开发者

how do i use @var on a function variable?

开发者 https://www.devze.com 2022-12-30 10:18 出处:网络
i\'ve got a variable $user that is of data type User (a class). i\'ve got it in a class method so i can\'t just type:

i've got a variable $user that is of data type User (a class).

i've got it in a class method so i can't just type:

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

because that will work only with class properties, not method variables like in this case.

how could i tell netbeans that that varia开发者_StackOverflowble is of data type User in a method?

Thanks!


From this answer, you can do this:

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

//netbeans should now autocomplete $user->
0

精彩评论

暂无评论...
验证码 换一张
取 消