mirror of
https://github.com/twigphp/Twig.git
synced 2026-09-12 10:26:32 +00:00
ensured that the use TokenParser returns a node instance
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
* 1.35.0 (2017-XX-XX)
|
||||
|
||||
* fixed use TokenParser to return an empty Node
|
||||
* added RuntimeExtensionInterface
|
||||
* added circular reference detection when loading templates
|
||||
|
||||
|
||||
@@ -57,6 +57,8 @@ class Twig_TokenParser_Use extends Twig_TokenParser
|
||||
$stream->expect(Twig_Token::BLOCK_END_TYPE);
|
||||
|
||||
$this->parser->addTrait(new Twig_Node(array('template' => $template, 'targets' => new Twig_Node($targets))));
|
||||
|
||||
return new Twig_Node();
|
||||
}
|
||||
|
||||
public function getTag()
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
--TEST--
|
||||
"use" tag with a parent block
|
||||
--TEMPLATE--
|
||||
{% extends "parent.twig" %}
|
||||
|
||||
{% use 'blocks.twig' %}
|
||||
|
||||
{% block body %}
|
||||
{{ parent() -}}
|
||||
CHILD
|
||||
{{ block('content') }}
|
||||
{% endblock %}
|
||||
--TEMPLATE(parent.twig)--
|
||||
{% block body %}
|
||||
PARENT
|
||||
{% endblock %}
|
||||
--TEMPLATE(blocks.twig)--
|
||||
{% block content 'BLOCK' %}
|
||||
--DATA--
|
||||
return array()
|
||||
--EXPECT--
|
||||
PARENT
|
||||
CHILD
|
||||
BLOCK
|
||||
Reference in New Issue
Block a user