From: Grégoire Pineau Date: Fri, 20 Sep 2013 15:27:06 +0000 (+0200) Subject: Fixed somes issues from SensioLabsInsight X-Git-Url: http://git.silmor.de/gitweb/?a=commitdiff_plain;h=e0da5ccee7ae09de1f9e72bbed6e30d625bc5e0d;p=web%2Fkonrad%2Ftwig.git Fixed somes issues from SensioLabsInsight --- diff --git a/lib/Twig/Extension/Core.php b/lib/Twig/Extension/Core.php index 60fe193..e366768 100644 --- a/lib/Twig/Extension/Core.php +++ b/lib/Twig/Extension/Core.php @@ -258,12 +258,12 @@ class Twig_Extension_Core extends Twig_Extension ); } - public function parseNotTestExpression(Twig_Parser $parser, $node) + public function parseNotTestExpression(Twig_Parser $parser, Twig_NodeInterface $node) { return new Twig_Node_Expression_Unary_Not($this->parseTestExpression($parser, $node), $parser->getCurrentToken()->getLine()); } - public function parseTestExpression(Twig_Parser $parser, $node) + public function parseTestExpression(Twig_Parser $parser, Twig_NodeInterface $node) { $stream = $parser->getStream(); $name = $stream->expect(Twig_Token::NAME_TYPE)->getValue(); diff --git a/lib/Twig/NodeVisitor/Optimizer.php b/lib/Twig/NodeVisitor/Optimizer.php index a254def..da81ea3 100644 --- a/lib/Twig/NodeVisitor/Optimizer.php +++ b/lib/Twig/NodeVisitor/Optimizer.php @@ -108,7 +108,7 @@ class Twig_NodeVisitor_Optimizer implements Twig_NodeVisitorInterface return $node; } - protected function optimizeVariables($node, $env) + protected function optimizeVariables(Twig_NodeInterface $node, Twig_Environment $env) { if ('Twig_Node_Expression_Name' === get_class($node) && $node->isSimple()) { $this->prependedNodes[0][] = $node->getAttribute('name'); @@ -129,7 +129,7 @@ class Twig_NodeVisitor_Optimizer implements Twig_NodeVisitorInterface * @param Twig_NodeInterface $node A Node * @param Twig_Environment $env The current Twig environment */ - protected function optimizePrintNode($node, $env) + protected function optimizePrintNode(Twig_NodeInterface $node, Twig_Environment $env) { if (!$node instanceof Twig_Node_Print) { return $node; @@ -153,7 +153,7 @@ class Twig_NodeVisitor_Optimizer implements Twig_NodeVisitorInterface * @param Twig_NodeInterface $node A Node * @param Twig_Environment $env The current Twig environment */ - protected function optimizeRawFilter($node, $env) + protected function optimizeRawFilter(Twig_NodeInterface $node, Twig_Environment $env) { if ($node instanceof Twig_Node_Expression_Filter && 'raw' == $node->getNode('filter')->getAttribute('value')) { return $node->getNode('node'); @@ -168,7 +168,7 @@ class Twig_NodeVisitor_Optimizer implements Twig_NodeVisitorInterface * @param Twig_NodeInterface $node A Node * @param Twig_Environment $env The current Twig environment */ - protected function enterOptimizeFor($node, $env) + protected function enterOptimizeFor(Twig_NodeInterface $node, Twig_Environment $env) { if ($node instanceof Twig_Node_For) { // disable the loop variable by default @@ -217,7 +217,7 @@ class Twig_NodeVisitor_Optimizer implements Twig_NodeVisitorInterface * @param Twig_NodeInterface $node A Node * @param Twig_Environment $env The current Twig environment */ - protected function leaveOptimizeFor($node, $env) + protected function leaveOptimizeFor(Twig_NodeInterface $node, Twig_Environment $env) { if ($node instanceof Twig_Node_For) { array_shift($this->loops); diff --git a/lib/Twig/Parser.php b/lib/Twig/Parser.php index bebdd9b..c0ac105 100644 --- a/lib/Twig/Parser.php +++ b/lib/Twig/Parser.php @@ -246,7 +246,7 @@ class Twig_Parser implements Twig_ParserInterface return $this->blocks[$name]; } - public function setBlock($name, $value) + public function setBlock($name, Twig_Node_Block $value) { $this->blocks[$name] = new Twig_Node_Body(array($value), array(), $value->getLine()); } diff --git a/lib/Twig/Token.php b/lib/Twig/Token.php index bbca90d..f3e3501 100644 --- a/lib/Twig/Token.php +++ b/lib/Twig/Token.php @@ -121,11 +121,10 @@ class Twig_Token * * @param integer $type The type as an integer * @param Boolean $short Whether to return a short representation or not - * @param integer $line The code line * * @return string The string representation */ - public static function typeToString($type, $short = false, $line = -1) + public static function typeToString($type, $short = false) { switch ($type) { case self::EOF_TYPE: @@ -178,11 +177,10 @@ class Twig_Token * Returns the english representation of a given type. * * @param integer $type The type as an integer - * @param integer $line The code line * * @return string The string representation */ - public static function typeToEnglish($type, $line = -1) + public static function typeToEnglish($type) { switch ($type) { case self::EOF_TYPE: