From 997c72b4e2363d14cf1c5f2e87a7271d6b285cae Mon Sep 17 00:00:00 2001 From: Cyril PASCAL Date: Tue, 3 Dec 2019 18:18:58 +0100 Subject: [PATCH] Add support for twig/twig:^3.0 --- composer.json | 2 +- lib/IgraalOSL/StatsTable/Dumper/HTML/HTMLDumper.php | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/composer.json b/composer.json index f992b6b..2ba8da6 100644 --- a/composer.json +++ b/composer.json @@ -28,7 +28,7 @@ "ext-json": "*", "phpoffice/phpspreadsheet": "^1.0", "phpunit/phpunit": "^8.2", - "twig/twig": "1.x@stable" + "twig/twig": "^1.0|^2.0|^3.0" }, "require": { "php": "^7.2" diff --git a/lib/IgraalOSL/StatsTable/Dumper/HTML/HTMLDumper.php b/lib/IgraalOSL/StatsTable/Dumper/HTML/HTMLDumper.php index d8e6b68..7edd482 100644 --- a/lib/IgraalOSL/StatsTable/Dumper/HTML/HTMLDumper.php +++ b/lib/IgraalOSL/StatsTable/Dumper/HTML/HTMLDumper.php @@ -6,6 +6,8 @@ use IgraalOSL\StatsTable\Dumper\Format; use IgraalOSL\StatsTable\StatsTable; use IgraalOSL\StatsTable\Tools\ParameterBag; +use Twig\Environment as Twig; +use Twig\Loader\FilesystemLoader as TwigFilesystemLoader; class HTMLDumper extends Dumper { @@ -25,7 +27,7 @@ class HTMLDumper extends Dumper protected $templateOptions; /** - * @var \Twig_Environment + * @var Twig */ protected $twig; @@ -35,11 +37,11 @@ public function __construct($options = []) $this->template = $options->get('template', $this->getDefaultTemplate()); $this->templateFolder = $options->get('templateFolder', $this->getDefaultTemplateFolder()); - $this->twig = new \Twig_Environment(new \Twig_Loader_Filesystem($this->templateFolder)); + $this->twig = new Twig(new TwigFilesystemLoader($this->templateFolder)); $this->templateOptions = $options->get('templateOptions',[]); } - public function setTwig(\Twig_Environment $twig) + public function setTwig(Twig $twig) { $this->twig = $twig; }