3

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 Answer 1

4

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)
}
Sign up to request clarification or add additional context in comments.

1 Comment

Thanks! That is exactly what i want!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.