removed obsolete code

This commit is contained in:
Fabien Potencier
2017-01-10 07:15:15 -08:00
parent 2a05ea563d
commit 4977bb5d1b
4 changed files with 4 additions and 22 deletions
+1 -6
View File
@@ -26,12 +26,7 @@ class Twig_Error_Loader extends Twig_Error
{
public function __construct($message, $lineno = -1, $source = null, Exception $previous = null)
{
if (PHP_VERSION_ID < 50300) {
$this->previous = $previous;
Exception::__construct('');
} else {
Exception::__construct('', 0, $previous);
}
Exception::__construct('', 0, $previous);
$this->appendMessage($message);
$this->setTemplateLine(false);
}
+1 -1
View File
@@ -30,7 +30,7 @@ class Twig_Node_Expression_NullCoalesce extends Twig_Node_Expression_Conditional
* cases might be implemented as an optimizer node visitor, but has not been done
* as benefits are probably not worth the added complexity.
*/
if (PHP_VERSION_ID >= 70000 && $this->getNode('expr2') instanceof Twig_Node_Expression_Name) {
if ($this->getNode('expr2') instanceof Twig_Node_Expression_Name) {
$this->getNode('expr2')->setAttribute('always_defined', true);
$compiler
->raw('((')
+1 -5
View File
@@ -46,11 +46,7 @@ abstract class Twig_Test_NodeTestCase extends PHPUnit_Framework_TestCase
{
$line = $line > 0 ? "// line {$line}\n" : '';
if (PHP_VERSION_ID >= 70000) {
return sprintf('%s($context["%s"] ?? null)', $line, $name, $name);
}
return sprintf('%s(isset($context["%s"]) ? $context["%s"] : null)', $line, $name, $name);
return sprintf('%s($context["%s"] ?? null)', $line, $name, $name);
}
protected function getAttributeGetter()
@@ -13,19 +13,10 @@ class Twig_Tests_Node_Expression_NullCoalesceTest extends Twig_Test_NodeTestCase
{
public function getTests()
{
$tests = array();
$left = new Twig_Node_Expression_Name('foo', 1);
$right = new Twig_Node_Expression_Constant(2, 1);
$node = new Twig_Node_Expression_NullCoalesce($left, $right, 1);
if (PHP_VERSION_ID >= 70000) {
$tests[] = array($node, "((// line 1\n\$context[\"foo\"]) ?? (2))");
} elseif (PHP_VERSION_ID >= 50400) {
$tests[] = array($node, "(((// line 1\narray_key_exists(\"foo\", \$context) && !(null === (isset(\$context[\"foo\"]) ? \$context[\"foo\"] : null)))) ? ((isset(\$context[\"foo\"]) ? \$context[\"foo\"] : null)) : (2))");
} else {
$tests[] = array($node, "(((// line 1\narray_key_exists(\"foo\", \$context) && !(null === \$this->getContext(\$context, \"foo\")))) ? (\$this->getContext(\$context, \"foo\")) : (2))");
}
return $tests;
return array(array($node, "((// line 1\n\$context[\"foo\"]) ?? (2))"));
}
}