diff --git a/composer.json b/composer.json index b1131d7..d1f4b96 100644 --- a/composer.json +++ b/composer.json @@ -16,9 +16,9 @@ "sort-packages": true }, "require": { - "php": "^7.1", + "php": "^7.1|^8", "doctrine/annotations": "^1.0", - "psliwa/php-pdf": "^1.1.5", + "psliwa/php-pdf": "^1.1.5|^2", "sensio/framework-extra-bundle": "^2|^3|^4|^5", "symfony/config": "^3.4|^4.0", "symfony/dependency-injection": "^3.4|^4.0", diff --git a/src/EventListener/PdfListener.php b/src/EventListener/PdfListener.php index 68f7d69..2d4c5b4 100644 --- a/src/EventListener/PdfListener.php +++ b/src/EventListener/PdfListener.php @@ -17,7 +17,7 @@ use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpKernel\Event\FilterControllerEvent; use Symfony\Component\HttpKernel\Event\FilterResponseEvent; -use Symfony\Component\Templating\EngineInterface; +use Twig\Environment as Engine; /** * This listener will replace reponse content by pdf document's content if Pdf annotations is found. @@ -33,7 +33,7 @@ class PdfListener private $templatingEngine; private $cache; - public function __construct(FacadeBuilder $pdfFacadeBuilder, Reader $annotationReader, Factory $reflectionFactory, EngineInterface $templatingEngine, Cache $cache) + public function __construct(FacadeBuilder $pdfFacadeBuilder, Reader $annotationReader, Factory $reflectionFactory, Engine $templatingEngine, Cache $cache) { $this->pdfFacadeBuilder = $pdfFacadeBuilder; $this->annotationReader = $annotationReader; diff --git a/src/Resources/config/pdf.xml b/src/Resources/config/pdf.xml index 266d5cf..b86005b 100644 --- a/src/Resources/config/pdf.xml +++ b/src/Resources/config/pdf.xml @@ -62,7 +62,7 @@ - + @@ -86,4 +86,4 @@ %ps_pdf.cache.options% - \ No newline at end of file + diff --git a/tests/EventListener/PdfListenerTest.php b/tests/EventListener/PdfListenerTest.php index d1ba47b..e013711 100644 --- a/tests/EventListener/PdfListenerTest.php +++ b/tests/EventListener/PdfListenerTest.php @@ -16,7 +16,7 @@ use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpKernel\Event\FilterControllerEvent; use Symfony\Component\HttpKernel\Event\FilterResponseEvent; -use Symfony\Component\Templating\EngineInterface; +use Twig\Environment as Engine; class PdfListenerTest extends TestCase { @@ -43,7 +43,8 @@ protected function setUp(): void ->setMethods(['render']) ->getMock(); - $this->templatingEngine = $this->getMockBuilder(EngineInterface::class) + $this->templatingEngine = $this->getMockBuilder(Engine::class) + ->disableOriginalConstructor() ->setMethods(['render', 'supports', 'exists']) ->getMock();