From cffc86e3b586991497089f8c80b435bcc103232c Mon Sep 17 00:00:00 2001 From: Jordi Date: Wed, 29 Jul 2020 09:47:12 +0200 Subject: [PATCH] Upgrade to Symfony 5.0 and Twig 3 --- composer.json | 18 +++++++--------- src/Templating/Helper/BaseHelper.php | 31 ++++++++++++++++++++++++---- 2 files changed, 35 insertions(+), 14 deletions(-) diff --git a/composer.json b/composer.json index 8f091901..ad0701bb 100644 --- a/composer.json +++ b/composer.json @@ -22,23 +22,21 @@ } ], "require": { - "php": "^7.1", - "symfony/config": "^4.4", - "symfony/dependency-injection": "^4.4", - "symfony/http-foundation": "^4.4", - "symfony/http-kernel": "^4.4", + "php": "^7.2", + "symfony/config": "^4.4 || ^5.0", + "symfony/dependency-injection": "^4.4 || ^5.0", + "symfony/http-foundation": "^4.4 || ^5.0", + "symfony/http-kernel": "^4.4 || ^5.0", "symfony/intl": "^4.4 || ^5.0", - "symfony/templating": "^4.4", - "twig/twig": "^2.9" + "twig/twig": "^2.9 || ^3.0" }, "conflict": { - "sonata-project/user-bundle": "<2.0 || >=5.0" + "sonata-project/user-bundle": "<3.6" }, "require-dev": { "matthiasnoback/symfony-dependency-injection-test": "^4.0", - "sonata-project/user-bundle": "^3.6 || ^4.0", "symfony/phpunit-bridge": "^5.1", - "symfony/security-core": "^4.4" + "symfony/security-core": "^4.4 || ^5.0" }, "config": { "sort-packages": true diff --git a/src/Templating/Helper/BaseHelper.php b/src/Templating/Helper/BaseHelper.php index 20dcce52..f380f57f 100644 --- a/src/Templating/Helper/BaseHelper.php +++ b/src/Templating/Helper/BaseHelper.php @@ -14,7 +14,6 @@ namespace Sonata\IntlBundle\Templating\Helper; use Sonata\IntlBundle\Locale\LocaleDetectorInterface; -use Symfony\Component\Templating\Helper\Helper; /** * BaseHelper provides charset conversion. @@ -28,8 +27,13 @@ * * @author Alexander */ -abstract class BaseHelper extends Helper +abstract class BaseHelper { + /** + * @var string + */ + protected $charset = 'UTF-8'; + /** * @var LocaleDetectorInterface */ @@ -40,11 +44,30 @@ abstract class BaseHelper extends Helper */ public function __construct($charset, LocaleDetectorInterface $localeDetector) { - $this->setCharset($charset); - + $this->charset = $charset; $this->localeDetector = $localeDetector; } + /** + * Sets the default charset. + * + * @param string $charset The charset + */ + public function setCharset($charset) + { + $this->charset = $charset; + } + + /** + * Gets the default charset. + * + * @return string The default charset + */ + public function getCharset() + { + return $this->charset; + } + /** * Typo in the method name. *