private function parseArrayDefinition($loc): string
    {
        $tokens = $this->getTokenStream();
        $found  = 0;
        $brace  = 0;
        $code   = '';
        do {
            $type = $tokens->type($loc);
            switch ($type) {
                case T_ARRAY:
                    $loc = $tokens->scan($loc, ['(']);
                    $brace++;
                // intentional fallthrough
                case '[':
                    $code .= '[';
                    $found++;
                    break;
                case '(':
                    $brace++;
                    $code .= '(';
                    break;
                case ']':
                    $found--;
                    $code .= ']';
                    break;
                case ')':
                    if (--$brace === 0) {
                        $found--;
                        $code .= ']';
                    } else {
                        $code .= ')';
                    }
                    break;
                default:
                    $code .= $this->arrayWhitespace($loc);
            }
        } while ($found > 0 && ($loc = $tokens->next($loc)));

        return $code;
    }