Code completion for array of objects in class implemented interface
I have interface and class
interface StoreFilterInterface
{
/**
* @param Store[] $stores
*
* @return Store[]
*/
public function filter(array $stores): array;
}
class LocalityIdStoreFilter implements StoreFilterInterface
{
/** @var int[] */
private $localityIds;
/**
* @param int[] $localityIds
*/
public function __construct(array $localityIds)
{
Assert::allInteger($localityIds);
$this->localityIds = $localityIds;
}
/**
* {@inheritdoc}
*/
public function filter(array $stores): array
{
$filteredStores = [];
foreach ($stores as $key => $store) {
$filteredStores[$key] = in_array($store->getLocalityId(), $this->localityIds, true);
}
return $filteredStores;
}
}
I have problem in code completion for $store variable

But, if I remove array type hint from $stores argument in interface and class, everything works fine

What should I do to use array typehint and not have problems with code completion.
PhpStorm 2017.3.3
Build #PS-173.4301.34, built on January 18, 2018
JRE: 1.8.0_152-release-1024-b11 x86_64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Mac OS X 10.13.2
Please sign in to leave a comment.
@inheritdoc for interfaces doesn't work correctly if I'm not mistaken. Please try to replace @inheritdoc PhpDoc with a full phpDoc
I can replace it with full phpdoc here, but I can't do it in hundred places in my project... So it is known problem, yes? I could'n find anything about it in google (I don't know what exactly I should search). Is issue exist about that problem?
Yes, that's a known issue: https://youtrack.jetbrains.com/issue/WI-18907 and also: https://youtrack.jetbrains.com/issue/WI-18906
thank you