Skip to content

[TwigBridge] Late deprecation for TwigRendererEngine::setEnvironment() #21021

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 23, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions UPGRADE-3.3.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
3 changes: 3 additions & 0 deletions UPGRADE-4.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should also be documented in the UPGRADE-3.3.md file.


Validator
---------

Expand Down
6 changes: 6 additions & 0 deletions src/Symfony/Bridge/Twig/Form/TwigRendererEngine.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,15 @@ public function __construct(array $defaultThemes = array(), \Twig_Environment $e

/**
* {@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;
}

Expand Down