8000 Deprecate TwigRendererEngine::setEnvironment() · symfony/symfony@5ef1565 · GitHub
[go: up one dir, main page]

Skip to content

Commit 5ef1565

Browse files
committed
Deprecate TwigRendererEngine::setEnvironment()
1 parent d29fc2c commit 5ef1565

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

UPGRADE-4.0.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,9 @@ TwigBridge
217217
* The possibility to inject the Form Twig Renderer into the form extension
218218
has been removed. Inject it into the `TwigRendererEngine` instead.
219219

220+
* The `TwigRendererEngine::setEnvironment()` method has been removed.
221+
Pass the Twig Environment as second argument of the constructor instead.
222+
220223
Validator
221224
---------
222225

src/Symfony/Bridge/Twig/Form/TwigRendererEngine.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,15 @@ public function __construct(array $defaultThemes = array(), \Twig_Environment $e
4141

4242
/**
4343
* {@inheritdoc}
44+
*
45+
* @deprecated since version 3.3, to be removed in 4.0
4446
*/
4547
public function setEnvironment(\Twig_Environment $environment)
4648
{
49+
if ($this->environment) {
50+
@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);
51+
}
52+
4753
$this->environment = $environment;
4854
}
4955

0 commit comments

Comments
 (0)
0