This commit is contained in:
Fabien Potencier 2013-08-11 20:06:26 +02:00
parent f39ed5706d
commit bbad387e4b
4 changed files with 15 additions and 17 deletions

View File

@ -62,10 +62,8 @@ class StopwatchExtensionTest extends TestCase
return array(
array('{% stopwatch foo %}something{% endstopwatch %}', 'foo'),
array('{% stopwatch foo %}symfony2 is fun{% endstopwatch %}{% stopwatch bar %}something{% endstopwatch %}', array('foo', 'bar')),
array('{% stopwatch foo %}something{% endstopwatch foo %}', 'foo'),
array("{% stopwatch 'foo.bar' %}something{% endstopwatch %}", 'foo.bar'),
array('{% stopwatch "foo.bar" %}something{% endstopwatch %}', 'foo.bar'),
);
}

View File

@ -41,7 +41,7 @@ class StopwatchTokenParser extends \Twig_TokenParser
}
if (in_array($name, $this->_events)) {
throw new \Twig_Error_Syntax(sprintf("The stopwatch event '%s' has already been defined", $name));
throw new \Twig_Error_Syntax(sprintf('The stopwatch event "%s" has already been defined.', $name));
}
$this->_events[] = $name;
@ -53,7 +53,7 @@ class StopwatchTokenParser extends \Twig_TokenParser
$value = $stream->next()->getValue();
if ($name != $value) {
throw new \Twig_Error_Syntax(sprintf("Expected endstopwatch for event '%s' (but %s given)", $name, $value));
throw new \Twig_Error_Syntax(sprintf('Expected endstopwatch for event "%s" (but "%s" given).', $name, $value));
}
}
$stream->expect(\Twig_Token::BLOCK_END_TYPE);