> */ private $promise; /** * @param Stream $stream */ public function __construct(Stream $stream) { $this->promise = call(function () use ($stream) { /** @psalm-var list $array */ $array = []; while (list($value) = yield $stream->continue()) { $array[] = $value; } return $array; }); } /** * @return Promise> */ public function promise(): Promise { return $this->promise; } }