8000 minor #10132 Remove obsolete conditions (fabpot) · symfony/symfony@aedb919 · GitHub
[go: up one dir, main page]

Skip to content

Commit aedb919

Browse files
committed
minor #10132 Remove obsolete conditions (fabpot)
This PR was merged into the 2.3 branch. Discussion ---------- Remove obsolete conditions | Q | A | ------------- | --- | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | n/a | License | MIT | Doc PR | n/a In `composer.json`, Twig version is set to 1.12 as a minimum, so all conditions about earlier Twig versions can be safely removed. Commits ------- c3ff76a [Twig] removed obsolete conditions on Twig versions
2 parents 82031dd + c3ff76a commit aedb919

File tree

4 files changed

+4
-43
lines changed

4 files changed

+4
-43
lines changed

src/Symfony/Bridge/Twig/Node/TransNode.php

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -95,22 +95,10 @@ protected function compileString(\Twig_NodeInterface $body, \Twig_Node_Expressio
9595

9696
preg_match_all('/(?<!%)%([^%]+)%/', $msg, $matches);
9797

98-
if (version_compare(\Twig_Environment::VERSION, '1.5', '>=')) {
99-
foreach ($matches[1] as $var) {
100-
$key = new \Twig_Node_Expression_Constant('%'.$var.'%', $body->getLine());
101-
if (!$vars->hasElement($key)) {
102-
$vars->addElement(new \Twig_Node_Expression_Name($var, $body->getLine()), $key);
103-
}
104-
}
105-
} else {
106-
$current = array();
107-
foreach ($vars as $name => $var) {
108-
$current[$name] = true;
109-
}
110-
foreach ($matches[1] as $var) {
111-
if (!isset($current['%'.$var.'%'])) {
112-
$vars->setNode('%'.$var.'%', new \Twig_Node_Expression_Name($var, $body->getLine()));
113-
}
98+
foreach ($matches[1] as $var) {
99+
$key = new \Twig_Node_Expression_Constant('%'.$var.'%', $body->getLine());
100+
if (!$vars->hasElement($key)) {
101+
$vars->addElement(new \Twig_Node_Expression_Name($var, $body->getLine()), $key);
114102
}
115103
}
116104

src/Symfony/Bridge/Twig/Tests/Node/FormThemeTest.php

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,6 @@
1616

1717
class FormThemeTest extends TestCase
1818
{
19-
protected function setUp()
20-
{
21-
parent::setUp();
22-
23-
if (version_compare(\Twig_Environment::VERSION, '1.5.0', '<')) {
24-
$this->markTestSkipped('Requires Twig version to be at least 1.5.0.');
25-
}
26-
}
27-
2819
public function testConstructor()
2920
{
3021
$form = new \Twig_Node_Expression_Name('form', 0);

src/Symfony/Bridge/Twig/Tests/Node/SearchAndRenderBlockNodeTest.php

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,6 @@
1616

1717
class SearchAndRenderBlockNodeTest extends TestCase
1818
{
19-
protected function setUp()
20-
{
21-
parent::setUp();
22-
23-
if (version_compare(\Twig_Environment::VERSION, '1.5.0', '<')) {
24-
$this->markTestSkipped('Requires Twig version to be at least 1.5.0.');
25-
}
26-
}
27-
2819
public function testCompileWidget()
2920
{
3021
$arguments = new \Twig_Node(array(

src/Symfony/Bridge/Twig/Tests/TokenParser/FormThemeTokenParserTest.php

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,6 @@
1717

1818
class FormThemeTokenParserTest extends TestCase
1919
{
20-
protected function setUp()
21-
{
22-
parent::setUp();
23-
24-
if (version_compare(\Twig_Environment::VERSION, '1.5.0', '<')) {
25-
$this->markTestSkipped('Requires Twig version to be at least 1.5.0.');
26-
}
27-
}
28-
2920
/**
3021
* @dataProvider getTestsForFormTheme
3122
*/

0 commit comments

Comments
 (0)
0