From 60bed592668220ad49592e2488422c3d44233726 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Fri, 11 Nov 2016 11:37:15 -0800 Subject: [PATCH] removed old code that is not needed anymore --- lib/Twig/ExpressionParser.php | 2 +- lib/Twig/Node/Expression/BlockReference.php | 15 +++++++++------ lib/Twig/TokenParser/Filter.php | 2 +- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/lib/Twig/ExpressionParser.php b/lib/Twig/ExpressionParser.php index 7e25df53e..43a8cf157 100644 --- a/lib/Twig/ExpressionParser.php +++ b/lib/Twig/ExpressionParser.php @@ -349,7 +349,7 @@ class Twig_ExpressionParser throw new Twig_Error_Syntax('The "block" function takes one argument (the block name).', $line, $this->parser->getStream()->getSourceContext()->getName()); } - return new Twig_Node_Expression_BlockReference($args->getNode(0), false, $line); + return new Twig_Node_Expression_BlockReference($args->getNode(0), $line); case 'attribute': $args = $this->parseArguments(); if (count($args) < 2) { diff --git a/lib/Twig/Node/Expression/BlockReference.php b/lib/Twig/Node/Expression/BlockReference.php index f6ed6ff4a..3fe7d0580 100644 --- a/lib/Twig/Node/Expression/BlockReference.php +++ b/lib/Twig/Node/Expression/BlockReference.php @@ -17,17 +17,20 @@ */ class Twig_Node_Expression_BlockReference extends Twig_Node_Expression { - public function __construct(Twig_NodeInterface $name, $asString = false, $lineno, $tag = null) + public function __construct(Twig_NodeInterface $name, $lineno, $tag = null) { - parent::__construct(array('name' => $name), array('as_string' => $asString, 'output' => false), $lineno, $tag); + if (is_bool($lineno)) { + @trigger_error(sprintf('The %s method "$asString" argument is deprecated since version 1.28 and will be removed in 2.0.', __METHOD__), E_USER_DEPRECATED); + + $lineno = $tag; + $tag = func_num_args() > 3 ? func_get_arg(3) : null; + } + + parent::__construct(array('name' => $name), array('output' => false), $lineno, $tag); } public function compile(Twig_Compiler $compiler) { - if ($this->getAttribute('as_string')) { - $compiler->raw('(string) '); - } - if ($this->getAttribute('output')) { $compiler ->addDebugInfo($this) diff --git a/lib/Twig/TokenParser/Filter.php b/lib/Twig/TokenParser/Filter.php index b20dd5b32..150cef739 100644 --- a/lib/Twig/TokenParser/Filter.php +++ b/lib/Twig/TokenParser/Filter.php @@ -23,7 +23,7 @@ class Twig_TokenParser_Filter extends Twig_TokenParser public function parse(Twig_Token $token) { $name = $this->parser->getVarName(); - $ref = new Twig_Node_Expression_BlockReference(new Twig_Node_Expression_Constant($name, $token->getLine()), true, $token->getLine(), $this->getTag()); + $ref = new Twig_Node_Expression_BlockReference(new Twig_Node_Expression_Constant($name, $token->getLine()), $token->getLine(), $this->getTag()); $filter = $this->parser->getExpressionParser()->parseFilterExpressionRaw($ref, $this->getTag()); $this->parser->getStream()->expect(Twig_Token::BLOCK_END_TYPE);