mirror of
https://github.com/slawkens/myaac.git
synced 2025-10-16 10:44:55 +02:00
Update Twig from 1.35.0 to 1.42.4 (PHP 5.5 is now required!)
This fixes some errors on PHP 7.4 and contains even more fixes Also bumped PHP version to 5.5 as Twig requires it.
This commit is contained in:
@@ -9,9 +9,15 @@
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
namespace Twig\Test;
|
||||
|
||||
abstract class Twig_Test_NodeTestCase extends TestCase
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Twig\Compiler;
|
||||
use Twig\Environment;
|
||||
use Twig\Loader\ArrayLoader;
|
||||
use Twig\Node\Node;
|
||||
|
||||
abstract class NodeTestCase extends TestCase
|
||||
{
|
||||
abstract public function getTests();
|
||||
|
||||
@@ -23,7 +29,7 @@ abstract class Twig_Test_NodeTestCase extends TestCase
|
||||
$this->assertNodeCompilation($source, $node, $environment, $isPattern);
|
||||
}
|
||||
|
||||
public function assertNodeCompilation($source, Twig_Node $node, Twig_Environment $environment = null, $isPattern = false)
|
||||
public function assertNodeCompilation($source, Node $node, Environment $environment = null, $isPattern = false)
|
||||
{
|
||||
$compiler = $this->getCompiler($environment);
|
||||
$compiler->compile($node);
|
||||
@@ -35,25 +41,25 @@ abstract class Twig_Test_NodeTestCase extends TestCase
|
||||
}
|
||||
}
|
||||
|
||||
protected function getCompiler(Twig_Environment $environment = null)
|
||||
protected function getCompiler(Environment $environment = null)
|
||||
{
|
||||
return new Twig_Compiler(null === $environment ? $this->getEnvironment() : $environment);
|
||||
return new Compiler(null === $environment ? $this->getEnvironment() : $environment);
|
||||
}
|
||||
|
||||
protected function getEnvironment()
|
||||
{
|
||||
return new Twig_Environment(new Twig_Loader_Array(array()));
|
||||
return new Environment(new ArrayLoader([]));
|
||||
}
|
||||
|
||||
protected function getVariableGetter($name, $line = false)
|
||||
{
|
||||
$line = $line > 0 ? "// line {$line}\n" : '';
|
||||
|
||||
if (PHP_VERSION_ID >= 70000) {
|
||||
return sprintf('%s($context["%s"] ?? null)', $line, $name, $name);
|
||||
if (\PHP_VERSION_ID >= 70000) {
|
||||
return sprintf('%s($context["%s"] ?? null)', $line, $name);
|
||||
}
|
||||
|
||||
if (PHP_VERSION_ID >= 50400) {
|
||||
if (\PHP_VERSION_ID >= 50400) {
|
||||
return sprintf('%s(isset($context["%s"]) ? $context["%s"] : null)', $line, $name, $name);
|
||||
}
|
||||
|
||||
@@ -62,7 +68,7 @@ abstract class Twig_Test_NodeTestCase extends TestCase
|
||||
|
||||
protected function getAttributeGetter()
|
||||
{
|
||||
if (function_exists('twig_template_get_attributes')) {
|
||||
if (\function_exists('twig_template_get_attributes')) {
|
||||
return 'twig_template_get_attributes($this, ';
|
||||
}
|
||||
|
||||
@@ -70,6 +76,4 @@ abstract class Twig_Test_NodeTestCase extends TestCase
|
||||
}
|
||||
}
|
||||
|
||||
class_alias('Twig_Test_NodeTestCase', 'Twig\Test\NodeTestCase', false);
|
||||
class_exists('Twig_Environment');
|
||||
class_exists('Twig_Node');
|
||||
class_alias('Twig\Test\NodeTestCase', 'Twig_Test_NodeTestCase');
|
||||
|
Reference in New Issue
Block a user