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
This commit is contained in:
commit
aedb919676
@ -95,22 +95,10 @@ class TransNode extends \Twig_Node
|
||||
|
||||
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 @@ use Symfony\Bridge\Twig\Node\FormThemeNode;
|
||||
|
||||
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 @@ use Symfony\Bridge\Twig\Node\SearchAndRenderBlockNode;
|
||||
|
||||
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 @@ use Symfony\Bridge\Twig\Node\FormThemeNode;
|
||||
|
||||
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
|
||||
*/
|
||||
|
Reference in New Issue
Block a user