Twig_Environment::parse PHP Method

parse() public method

public parse ( Twig_TokenStream $tokens )
$tokens Twig_TokenStream
    public function parse(Twig_TokenStream $tokens)
    {
        return $this->getParser()->parse($tokens);
    }

Same methods

Twig_Environment::parse ( Twig_TokenStream $tokens ) : Twig_Node_Module

Usage Example

 public function testEmptyConstant()
 {
     $stream = $this->environment->parse($this->environment->tokenize('{{ constant("ExtensionTest::SOME_EMPTY_VALUE") }}', 'index'));
     $node = $stream->getNode('body')->getNode(0);
     $this->assertEquals(Twig_Node_Print::class, get_class($node));
     $this->assertEquals(ExtensionTest::SOME_EMPTY_VALUE, $node->getNode('expr')->getAttribute('value'));
 }
All Usage Examples Of Twig_Environment::parse