Permalink
Browse files

[Twig] removed obsolete conditions on Twig versions

  • Loading branch information...
fabpot committed Jan 25, 2014
1 parent f71193c commit c3ff76a989dcc67f2850ba19a5ea73aa586dbc32
@@ -95,22 +95,10 @@ protected function compileString(\Twig_NodeInterface $body, \Twig_Node_Expressio
preg_match_all('/(?<!%)%([^%]+)%/', $msg, $matches);
if (version_compare(\Twig_Environment::VERSION, '1.5', '>=')) {
foreach ($matches[1] as $var) {
$key = new \Twig_Node_Expression_Constant('%'.$var.'%', $body->getLine());
if (!$vars->hasElement($key)) {
$vars->addElement(new \Twig_Node_Expression_Name($var, $body->getLine()), $key);
}
}
} else {
$current = array();
foreach ($vars as $name => $var) {
$current[$name] = true;
}
foreach ($matches[1] as $var) {
if (!isset($current['%'.$var.'%'])) {
$vars->setNode('%'.$var.'%', new \Twig_Node_Expression_Name($var, $body->getLine()));
}
foreach ($matches[1] as $var) {
$key = new \Twig_Node_Expression_Constant('%'.$var.'%', $body->getLine());
if (!$vars->hasElement($key)) {
$vars->addElement(new \Twig_Node_Expression_Name($var, $body->getLine()), $key);
}
}
@@ -16,15 +16,6 @@
class FormThemeTest extends TestCase
{
protected function setUp()
{
parent::setUp();
if (version_compare(\Twig_Environment::VERSION, '1.5.0', '<')) {
$this->markTestSkipped('Requires Twig version to be at least 1.5.0.');
}
}
public function testConstructor()
{
$form = new \Twig_Node_Expression_Name('form', 0);
@@ -16,15 +16,6 @@
class SearchAndRenderBlockNodeTest extends TestCase
{
protected function setUp()
{
parent::setUp();
if (version_compare(\Twig_Environment::VERSION, '1.5.0', '<')) {
$this->markTestSkipped('Requires Twig version to be at least 1.5.0.');
}
}
public function testCompileWidget()
{
$arguments = new \Twig_Node(array(
@@ -17,15 +17,6 @@
class FormThemeTokenParserTest extends TestCase
{
protected function setUp()
{
parent::setUp();
if (version_compare(\Twig_Environment::VERSION, '1.5.0', '<')) {
$this->markTestSkipped('Requires Twig version to be at least 1.5.0.');
}
}
/**
* @dataProvider getTestsForFormTheme
*/

0 comments on commit c3ff76a

Please sign in to comment.