private function parseOptional(Input $definition, TypeCollection $types, array $attributes): OptionalPath
    {
        $definition->expect("[");

        $optional = $this->parseRoute($definition, $types, $attributes);

        $definition->expect("]");

        return new OptionalPath($optional);
    }
private function parseOptional(Input $definition, TypeCollection $types, array $attributes): OptionalPath
    {
        $definition->expect("[");

        $optional = $this->parseRoute($definition, $types, $attributes);

        $definition->expect("]");

        return new OptionalPath($optional);
    }
private function parseOptional ( Input $ definition , TypeCollection $ types , array $ attributes ) : OptionalPath { $ definition -> expect ( "[" ) ; $ optional = $ this -> parseRoute ( $ definition , $ types , $ attributes ) ; $ definition -> expect ( "]" ) ; return new OptionalPath ( $ optional ) ; }
Parse the optional part of the route definition.

@param Input $definition
@param TypeCollection $types
@param string[] $attributes
@return OptionalPath
@throws InvalidRoute
@throws UnexpectedChar
Parse the optional part of the route definition .