Permalink
Browse files

allowed empty templates to be used as traits

  • Loading branch information...
1 parent a7fdec2 commit 56f82db1a1cd26b3eaace6cd1a6d3daf18c37b76 @fabpot committed Sep 22, 2011
View
4 CHANGELOG
@@ -1,3 +1,7 @@
+* 1.3.0
+
+ * allowed empty templates to be used as traits
+
* 1.2.0 (2011-09-13)
no changes
View
4 lib/Twig/Node/Module.php
@@ -255,6 +255,10 @@ protected function compileIsTraitable(Twig_Compiler $compiler)
}
foreach ($nodes as $node) {
+ if (!count($node)) {
+ continue;
+ }
+
if ($node instanceof Twig_Node_Text && ctype_space($node->getAttribute('data'))) {
continue;
}
View
10 test/Twig/Tests/Fixtures/tags/use/deep_empty.test
@@ -0,0 +1,10 @@
+--TEST--
+"use" tag
+--TEMPLATE--
+{% use "foo.twig" %}
+--TEMPLATE(foo.twig)--
+{% use "bar.twig" %}
+--TEMPLATE(bar.twig)--
+--DATA--
+return array()
+--EXPECT--
View
2 test/Twig/Tests/Node/ModuleTest.php
@@ -88,7 +88,7 @@ public function getTemplateName()
public function isTraitable()
{
- return false;
+ return true;
}
}
EOF
View
2 test/Twig/Tests/Node/SandboxedModuleTest.php
@@ -95,7 +95,7 @@ public function getTemplateName()
public function isTraitable()
{
- return false;
+ return true;
}
}
EOF

0 comments on commit 56f82db

Please sign in to comment.