如何设置PhpStorm识别变量的类

时间:2015-11-03 10:21:14

标签: php phpstorm phpdoc

我在PhpStorm中遇到了问题。我有一个代码:

/**
 * $this->data['rows'] My_Class[]
 */
public function countRows(){
    foreach($this->data['rows'] as $row){
        $row->(here i want to get all functions in a class with autocomplete)
    }
}

这里我尝试使用PhpStorm自动完成帮助程序来实现类函数,但这不起作用。

如何使用PHPDoc定义一些变量精确类或类型?

1 个答案:

答案 0 :(得分:4)

您可以使用$row PHPDoc评论直接输入提示/** @var MyClass $row */变量:

foreach($this->data['rows'] as $row){
    /** @var MyClass $row */
    $row->(here i want to get all functions in a class with autocomplete)
}
相关问题