diff --git a/composer.json b/composer.json index d8334e3..8d5a26f 100644 --- a/composer.json +++ b/composer.json @@ -40,7 +40,7 @@ "symfony/framework-bundle": "^4.4 || ^5.0", "symfony/http-foundation": "^4.4 || ^5.1", "symfony/http-kernel": "^4.4 || ^5.1", - "symfony/phpunit-bridge": "^5.1", + "symfony/phpunit-bridge": "^5.1.1", "symfony/twig-bundle": "^4.4 || ^5.1" }, "config": { diff --git a/src/Bridge/Symfony/DependencyInjection/Configuration.php b/src/Bridge/Symfony/DependencyInjection/Configuration.php index c47453c..c3b3548 100644 --- a/src/Bridge/Symfony/DependencyInjection/Configuration.php +++ b/src/Bridge/Symfony/DependencyInjection/Configuration.php @@ -13,6 +13,7 @@ namespace Sonata\Twig\Bridge\Symfony\DependencyInjection; +use Symfony\Component\Config\Definition\BaseNode; use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition; use Symfony\Component\Config\Definition\Builder\TreeBuilder; use Symfony\Component\Config\Definition\ConfigurationInterface; @@ -63,7 +64,7 @@ private function addFlashMessageSection(ArrayNodeDefinition $node): void ->children() ->scalarNode('domain') ->defaultValue('SonataTwigBundle') - ->setDeprecated('The child node "%node%" at path "%path%" is deprecated since sonata-project/twig-extensions 1.4 and will be removed in 2.0 version. Translate you message before add it to session flash.') + ->setDeprecated(...$this->getDomainParamDeprecationMsg()) ->end() ->end() ->end() @@ -74,4 +75,20 @@ private function addFlashMessageSection(ArrayNodeDefinition $node): void ->end() ; } + + // BC layer for deprecation messages for symfony/config < 5.1 + private function getDomainParamDeprecationMsg(): array + { + $message = 'The child node "%node%" at path "%path%" is deprecated since sonata-project/twig-extensions 1.4 and will be removed in 2.0 version. Translate you message before add it to session flash.'; + + if (method_exists(BaseNode::class, 'getDeprecation')) { + return [ + 'sonata-project/twig-extensions', + '1.4', + $message, + ]; + } + + return [$message]; + } } diff --git a/tests/App/config.yml b/tests/App/config.yml index fa703bb..560d11e 100644 --- a/tests/App/config.yml +++ b/tests/App/config.yml @@ -7,5 +7,7 @@ framework: name: 'MOCKSESSID' twig: + exception_controller: null paths: - '%kernel.project_dir%/templates' + strict_variables: '%kernel.debug%'