result = $result; parent::__construct(new Emitter(static function (callable $emit) use ($result) { for ($count = 0; $row = $result->fetchRow(pq\Result::FETCH_ASSOC); ++$count) { yield $emit($row); } return $count; })); } public function numRows(): int { return $this->result->numRows; } public function numFields(): int { return $this->result->numCols; } public function count(): int { return $this->numRows(); } }