From 0127666ebd0a6aa0c69a768f7276a79fdc8f14ee Mon Sep 17 00:00:00 2001 From: Koen van Wijnen Date: Wed, 5 Feb 2020 07:25:08 +0100 Subject: [PATCH] Replaced deprecated global Twig functions (#366) --- Twig/Extension/UploaderExtension.php | 14 ++++++++------ composer.json | 3 ++- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/Twig/Extension/UploaderExtension.php b/Twig/Extension/UploaderExtension.php index a8664b11..a5a7c440 100644 --- a/Twig/Extension/UploaderExtension.php +++ b/Twig/Extension/UploaderExtension.php @@ -3,8 +3,10 @@ namespace Oneup\UploaderBundle\Twig\Extension; use Oneup\UploaderBundle\Templating\Helper\UploaderHelper; +use Twig\Extension\AbstractExtension; +use Twig\TwigFunction; -class UploaderExtension extends \Twig_Extension +class UploaderExtension extends AbstractExtension { protected $helper; @@ -21,11 +23,11 @@ public function getName() public function getFunctions() { return [ - new \Twig_SimpleFunction('oneup_uploader_endpoint', [$this, 'endpoint']), - new \Twig_SimpleFunction('oneup_uploader_progress', [$this, 'progress']), - new \Twig_SimpleFunction('oneup_uploader_cancel', [$this, 'cancel']), - new \Twig_SimpleFunction('oneup_uploader_upload_key', [$this, 'uploadKey']), - new \Twig_SimpleFunction('oneup_uploader_maxsize', [$this, 'maxSize']), + new TwigFunction('oneup_uploader_endpoint', [$this, 'endpoint']), + new TwigFunction('oneup_uploader_progress', [$this, 'progress']), + new TwigFunction('oneup_uploader_cancel', [$this, 'cancel']), + new TwigFunction('oneup_uploader_upload_key', [$this, 'uploadKey']), + new TwigFunction('oneup_uploader_maxsize', [$this, 'maxSize']), ]; } diff --git a/composer.json b/composer.json index 6da94639..3a90d012 100644 --- a/composer.json +++ b/composer.json @@ -28,7 +28,8 @@ "symfony/http-foundation": "^3.0|^4.0", "symfony/templating": "^3.0|^4.0", "symfony/translation": "^3.0|^4.0", - "symfony/yaml": "^3.0|^4.0" + "symfony/yaml": "^3.0|^4.0", + "twig/twig": "^1.41|^2.10|^3.0" }, "require-dev": {