src/ContainerParser/Parser/ScopeParser.php
protected function next()
    {
        $token = $this->currentToken();

        // is the current state in override mode?
        if ($token->isType(T::TOKEN_OVERRIDE)) 
        {
            // set the indicating token to the next one
            $token = $this->nextToken();

            // only allow override of service and parameter definitions
            if (!($token->isType(T::TOKEN_PARAMETER) || $token->isType(T::TOKEN_DEPENDENCY)))
            {
                throw $this->errorUnexpectedToken($this->currentToken());
            }
        }

        // is parameter definition
        if ($token->isType(T::TOKEN_PARAMETER)) 
        {
            $this->scope->addNode($this->parseChild(ParameterDefinitionParser::class));
        }

        // is service definition
        elseif ($token->isType(T::TOKEN_DEPENDENCY)) 
        {
            $this->scope->addNode($this->parseChild(ServiceDefinitionParser::class));
        }

        // import another scope
        elseif ($token->isType(T::TOKEN_IMPORT)) 
        {
            $this->scope->addNode($this->parseChild(ScopeImportParser::class));
        }

        // just a linebreak
        elseif ($token->isType(T::TOKEN_LINE)) 
        {
            $this->skipToken();
        }

        // anything else?
        else 
        {
            throw $this->errorUnexpectedToken($token);
        }
    }
protected function next()
    {
        $token = $this->currentToken();

        // is the current state in override mode?
        if ($token->isType(T::TOKEN_OVERRIDE)) 
        {
            // set the indicating token to the next one
            $token = $this->nextToken();

            // only allow override of service and parameter definitions
            if (!($token->isType(T::TOKEN_PARAMETER) || $token->isType(T::TOKEN_DEPENDENCY)))
            {
                throw $this->errorUnexpectedToken($this->currentToken());
            }
        }

        // is parameter definition
        if ($token->isType(T::TOKEN_PARAMETER)) 
        {
            $this->scope->addNode($this->parseChild(ParameterDefinitionParser::class));
        }

        // is service definition
        elseif ($token->isType(T::TOKEN_DEPENDENCY)) 
        {
            $this->scope->addNode($this->parseChild(ServiceDefinitionParser::class));
        }

        // import another scope
        elseif ($token->isType(T::TOKEN_IMPORT)) 
        {
            $this->scope->addNode($this->parseChild(ScopeImportParser::class));
        }

        // just a linebreak
        elseif ($token->isType(T::TOKEN_LINE)) 
        {
            $this->skipToken();
        }

        // anything else?
        else 
        {
            throw $this->errorUnexpectedToken($token);
        }
    }
Parse the next token

@return null|Node