mirror of
https://github.com/twigphp/Twig.git
synced 2026-09-12 02:16:41 +00:00
minor #2350 Remove obsolete code (fabpot)
This PR was merged into the 2.x branch.
Discussion
----------
Remove obsolete code
Commits
-------
4977bb5d removed obsolete code
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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('((')
|
||||
|
||||
@@ -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))"));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user