Hello. How to correctly describe the return type of the method in PHPDoc:
/** * @return \Generator */ public function getLayers() { foreach($this->layers as $layer) yield $layer; } } When used in a loop, PHPStorm does not understand which type it iterates:
foreach ($this->getLayers() as $layer) $layer->... //PHPStorm: "я не знаю что это!" At the same time, if just returning an array, it would be possible to describe it like this:
/** * @return LayerType[] */ public function getLayers() { return $this->layers; } This way, when iterating, it recognizes objects.