3
votes

I stacked with a problem in PhpStorm. I have a code:

/**
 * $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)
    }
}

Here I am trying to reach Class functions with PhpStorm autocomplete helper but this doesn't work.

How could I define some variable exact class or type with PHPDoc?

1

1 Answers

4
votes

You can type hint $row variable directly with /** @var MyClass $row */ PHPDoc comment:

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