0

Is there any correct PHPDoc to recognize the PhpStorm for autocomplete/suggest on this source?

class someClass
{
    public $foo;

    const BAR = 1;

    public function doSomething()
    {
        return 2;
    }
}

/** @var $arrayClass[] someClass */ $arrayClass = [];
for($i = 0; $i < 5; $i++)
{
    $arrayClass[$i] = new someClass();
    $arrayClass[$i]->             # <---here says No suggestions when (ctrl+space)
}

enter image description here

1 Answer 1

1

Found the solution for PhpStorm (if anyone search for this)

I was change the bracets position and works

from

/** @var $arrayClass[] someClass */ $arrayClass = [];

to

/** @var $arrayClass someClass[] */ $arrayClass = [];
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.