8000 Remove obsolete conditions by fabpot · Pull Request #10132 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

Remove obsolete conditions #10132

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 25, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 4 additions & 16 deletions src/Symfony/Bridge/Twig/Node/TransNode.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

Expand Down
9 changes: 0 additions & 9 deletions src/Symfony/Bridge/Twig/Tests/Node/FormThemeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down
0