Filesystem/CsvResource.php
public function readLine($length = null): ?array
    {
        $values = $this->readRaw($length);

        if (false === $values) {
            if ($this->isEndOfFile()) {
                return null;
            }
            $message = "Unable to parse data on line {$this->currentLine} for {$this->getResourceName()}";
            throw new \UnexpectedValueException($message);
        }

        $count = \count($values);
        if ($count !== $this->headerCount) {
            $message = "Number of columns not matching on line {$this->currentLine} for {$this->getResourceName()}: ";
            $message .= "{$count} columns for {$this->headerCount} headers";
            throw new \UnexpectedValueException($message);
        }

        $combined = array_combine($this->headers, $values);
        if (false === $combined) {
            throw new \RuntimeException('Cannot combine headers with values');
        }

        return $combined;
    }
public function readLine($length = null): ?array
    {
        $values = $this->readRaw($length);

        if (false === $values) {
            if ($this->isEndOfFile()) {
                return null;
            }
            $message = "Unable to parse data on line {$this->currentLine} for {$this->getResourceName()}";
            throw new \UnexpectedValueException($message);
        }

        $count = \count($values);
        if ($count !== $this->headerCount) {
            $message = "Number of columns not matching on line {$this->currentLine} for {$this->getResourceName()}: ";
            $message .= "{$count} columns for {$this->headerCount} headers";
            throw new \UnexpectedValueException($message);
        }

        $combined = array_combine($this->headers, $values);
        if (false === $combined) {
            throw new \RuntimeException('Cannot combine headers with values');
        }

        return $combined;
    }
@param int|null $length

@throws \UnexpectedValueException
@throws \RuntimeException

@return array