protected function dumpArray(array $input, string $indent, int $outerLineLength): string
    {
        if (!$input) {
            return '[]';
        }

        if ($outerLineLength < $this->lineLength) {
            $dump = $this->tryDumpList($input, $outerLineLength, 1);
            if (null !== $dump) {
                return $dump;
            }
        }

        $next_indent = $indent . $this->indent;
        $next_indent_length = $outerLineLength + $this->indentLength;

        $dump = '[' . $this->eol;
        $index = 0;
        $still_linear = true;
        foreach ($input as $key => $value) {
            $item = $next_indent;
            $item_outer_length = $next_indent_length;

            if ($still_linear && $key === $index) {
                ++$index;
            } else {
                $still_linear = false;

                $key_dump = $this->dumpValue($key);
                $item .= $key_dump . ' => ';
                $item_outer_length += 4 + StringHelper::lengthUtf8($key_dump);
            }

            if (\is_array($value)) {
                // there will be trailing comma ',' after value, so outer length gives +1
                $value_dump = $this->dumpArray($value, $next_indent, $item_outer_length + 1);
            } else {
                $value_dump = $this->dumpValue($value);
            }

            $item .= $value_dump;

            $dump .= $item . ',' . $this->eol;
        }

        $dump .= $indent . ']';

        return $dump;
    }