From c9501b80a12593b07a62f16afac0ab8018eb0069 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Wed, 12 Aug 2015 11:28:53 +0200 Subject: [PATCH] deprecated Twig_Template::getEnvironment() --- CHANGELOG | 1 + doc/deprecated.rst | 4 ++++ lib/Twig/Template.php | 4 +++- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG b/CHANGELOG index 0919dd566..185d2d947 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,5 +1,6 @@ * 1.20.0 (2015-XX-XX) + * deprecated Twig_Template::getEnvironment() * deprecated the _self variable for usage outside of the from and import tags * added Twig_BaseNodeVisitor to ease the compatibility of node visitors between 1.x and 2.x diff --git a/doc/deprecated.rst b/doc/deprecated.rst index 2a9fa391f..9afc24104 100644 --- a/doc/deprecated.rst +++ b/doc/deprecated.rst @@ -130,3 +130,7 @@ Miscellaneous * As of Twig 1.x, ``Twig_Environment::clearTemplateCache()`` is deprecated and will be removed in 2.0. + +* As of Twig 1.x, ``Twig_Template::getEnvironment()`` and + ``Twig_TemplateInterface::getEnvironment()`` are deprecated and will be + removed in 2.0. diff --git a/lib/Twig/Template.php b/lib/Twig/Template.php index 3ef765821..6eb2c3601 100644 --- a/lib/Twig/Template.php +++ b/lib/Twig/Template.php @@ -45,10 +45,12 @@ abstract class Twig_Template implements Twig_TemplateInterface abstract public function getTemplateName(); /** - * {@inheritdoc} + * @deprecated since 1.20 (to be removed in 2.0) */ public function getEnvironment() { + @trigger_error('The '.__METHOD__.' method is deprecated since version 1.20 and will be removed in 2.0.', E_USER_DEPRECATED); + return $this->env; }