mirror of
https://github.com/twigphp/Twig.git
synced 2026-09-14 19:36:43 +00:00
Remove hack to inline throwing an exception
This commit is contained in:
@@ -66,11 +66,11 @@ class NameExpression extends AbstractExpression
|
|||||||
->string($name)
|
->string($name)
|
||||||
->raw(', $context) ? $context[')
|
->raw(', $context) ? $context[')
|
||||||
->string($name)
|
->string($name)
|
||||||
->raw('] : (function () { throw new RuntimeError(\'Variable ')
|
->raw('] : throw new RuntimeError(\'Variable ')
|
||||||
->string($name)
|
->string($name)
|
||||||
->raw(' does not exist.\', ')
|
->raw(' does not exist.\', ')
|
||||||
->repr($this->lineno)
|
->repr($this->lineno)
|
||||||
->raw(', $this->source); })()')
|
->raw(', $this->source)')
|
||||||
->raw(')')
|
->raw(')')
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ class NameTest extends NodeTestCase
|
|||||||
$env = new Environment($this->createMock(LoaderInterface::class), ['strict_variables' => true]);
|
$env = new Environment($this->createMock(LoaderInterface::class), ['strict_variables' => true]);
|
||||||
$env1 = new Environment($this->createMock(LoaderInterface::class), ['strict_variables' => false]);
|
$env1 = new Environment($this->createMock(LoaderInterface::class), ['strict_variables' => false]);
|
||||||
|
|
||||||
$output = '(isset($context["foo"]) || array_key_exists("foo", $context) ? $context["foo"] : (function () { throw new RuntimeError(\'Variable "foo" does not exist.\', 1, $this->source); })())';
|
$output = '(isset($context["foo"]) || array_key_exists("foo", $context) ? $context["foo"] : throw new RuntimeError(\'Variable "foo" does not exist.\', 1, $this->source))';
|
||||||
|
|
||||||
return [
|
return [
|
||||||
[$node, "// line 1\n".$output, $env],
|
[$node, "// line 1\n".$output, $env],
|
||||||
|
|||||||
Reference in New Issue
Block a user