From aabb73cab869e1eb797ace2071d1b80f652ba4e0 Mon Sep 17 00:00:00 2001 From: Robin Chalas Date: Thu, 22 Dec 2016 11:31:59 +0100 Subject: [PATCH] Deprecate TwigRendererEngine::setEnvironment() --- UPGRADE-3.3.md | 6 ++++++ UPGRADE-4.0.md | 3 +++ src/Symfony/Bridge/Twig/Form/TwigRendererEngine.php | 6 ++++++ 3 files changed, 15 insertions(+) diff --git a/UPGRADE-3.3.md b/UPGRADE-3.3.md index c4af5b539d..dcfc81bb30 100644 --- a/UPGRADE-3.3.md +++ b/UPGRADE-3.3.md @@ -38,3 +38,9 @@ SecurityBundle * The `FirewallContext::getContext()` method has been deprecated and will be removed in 4.0. Use the `getListeners()` method instead. + +TwigBridge +---------- + + * The `TwigRendererEngine::setEnvironment()` method has been deprecated and will be removed + in 4.0. Pass the Twig Environment as second argument of the constructor instead. diff --git a/UPGRADE-4.0.md b/UPGRADE-4.0.md index 0da7138810..20b8b09ab8 100644 --- a/UPGRADE-4.0.md +++ b/UPGRADE-4.0.md @@ -217,6 +217,9 @@ TwigBridge * The possibility to inject the Form Twig Renderer into the form extension has been removed. Inject it into the `TwigRendererEngine` instead. + * The `TwigRendererEngine::setEnvironment()` method has been removed. + Pass the Twig Environment as second argument of the constructor instead. + Validator --------- diff --git a/src/Symfony/Bridge/Twig/Form/TwigRendererEngine.php b/src/Symfony/Bridge/Twig/Form/TwigRendererEngine.php index fe99929df0..406726ccdc 100644 --- a/src/Symfony/Bridge/Twig/Form/TwigRendererEngine.php +++ b/src/Symfony/Bridge/Twig/Form/TwigRendererEngine.php @@ -41,9 +41,15 @@ class TwigRendererEngine extends AbstractRendererEngine implements TwigRendererE /** * {@inheritdoc} + * + * @deprecated since version 3.3, to be removed in 4.0 */ public function setEnvironment(\Twig_Environment $environment) { + if ($this->environment) { + @trigger_error(sprintf('The "%s()" method is deprecated since version 3.3 and will be removed in 4.0. Pass the Twig Environment as second argument of the constructor instead.', __METHOD__), E_USER_DEPRECATED); + } + $this->environment = $environment; }