mirror of
https://github.com/twigphp/Twig.git
synced 2026-10-12 06:45:53 +00:00
Merge branch '1.x' into 2.x
* 1.x: added more tests added missing hints in some runtime exceptions
This commit is contained in:
@@ -35,16 +35,17 @@ class WithNode extends Node
|
||||
$compiler->addDebugInfo($this);
|
||||
|
||||
if ($this->hasNode('variables')) {
|
||||
$node = $this->getNode('variables');
|
||||
$varsName = $compiler->getVarName();
|
||||
$compiler
|
||||
->write(sprintf('$%s = ', $varsName))
|
||||
->subcompile($this->getNode('variables'))
|
||||
->subcompile($node)
|
||||
->raw(";\n")
|
||||
->write(sprintf("if (!twig_test_iterable(\$%s)) {\n", $varsName))
|
||||
->indent()
|
||||
->write("throw new RuntimeError('Variables passed to the \"with\" tag must be a hash.', ")
|
||||
->repr($this->getTemplateLine())
|
||||
->raw(", \$this->source);\n")
|
||||
->repr($node->getTemplateLine())
|
||||
->raw(", \$this->getSourceContext());\n")
|
||||
->outdent()
|
||||
->write("}\n")
|
||||
->write(sprintf("\$%s = twig_to_array(\$%s);\n", $varsName, $varsName))
|
||||
|
||||
Reference in New Issue
Block a user