Twig/TokenParser/ExtendsMyConfiguredLayoutTokenParser.php
public function parse(\Twig_Token $token)
    {
        if (null !== $this->parser->getParent()) {
            throw new \Twig_Error_Syntax('Multiple extends tags are forbidden', $token->getLine());
        }

        $tpl = $this->container->getParameter($this->parser->getCurrentToken()->getValue());

        $this->parser->getExpressionParser()->parseExpression();

        $this->parser->setParent(new \Twig_Node_Expression_Constant($tpl,$token->getLine()));
        $this->parser->getStream()->expect(\Twig_Token::BLOCK_END_TYPE);

        return null;
    }
public function parse(\Twig_Token $token)
    {
        if (null !== $this->parser->getParent()) {
            throw new \Twig_Error_Syntax('Multiple extends tags are forbidden', $token->getLine());
        }

        $tpl = $this->container->getParameter($this->parser->getCurrentToken()->getValue());

        $this->parser->getExpressionParser()->parseExpression();

        $this->parser->setParent(new \Twig_Node_Expression_Constant($tpl,$token->getLine()));
        $this->parser->getStream()->expect(\Twig_Token::BLOCK_END_TYPE);

        return null;
    }
Parses a token and returns a node.

@param \Twig_Token $token A \Twig_Token instance

@return \Twig_NodeInterface A \Twig_NodeInterface instance