protected function tryDumpList(array $input, int $outerLineLength, int $level): ?string
    {
        if ($level > $this->listDepthLimit) {
            return null;
        }

        $dump = '[';
        $total_length = $outerLineLength + 1;

        $index = 0;
        foreach ($input as $key => $value) {
            if ($key !== $index) {
                return null;
            }

            if ($index > 0) {
                $dump .= ', ';
                $total_length += 2;
            }

            if ($total_length >= $this->lineLength) {
                return null;
            }

            ++$index;

            if (\is_array($value)) {
                $value_dump = $this->tryDumpList($value, $total_length, $level + 1);
                if (null === $value_dump) {
                    return null;
                }
            } else {
                $value_dump = $this->dumpValue($value);
            }

            $total_length += StringHelper::lengthUtf8($value_dump);
            if ($total_length >= $this->lineLength) {
                return null;
            }

            $dump .= $value_dump;
        }

        $total_length += 1;
        if ($total_length > $this->lineLength) {
            return null;
        }

        $dump .= ']';
        return $dump;
    }