Reputation: 1234
I know that for variables which aren't declared as types PhpStorm doesn't know where to look for method calls on variable names sometimes.
I know how to solve it for simple variable by providing typehint via simple PHPDoc comment :
/* @var Category $category */
$category->getNameTranslit();
but how can I do this for methods called for array element?
$categories[$key]->setIsActive(true);
Upvotes: 1
Views: 438
Reputation: 1234
The answer appeared to be:
/** @var Category[] $categories */
$categories[$key]->setIsActive(true);
Thank you LazyOne!
Upvotes: 1