mirror of
https://github.com/twigphp/Twig.git
synced 2026-09-18 21:37:29 +00:00
deprecated passing a Twig\Template to load()/resolveTemplate()
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
* 2.7.0 (2019-XX-XX)
|
* 2.7.0 (2019-XX-XX)
|
||||||
|
|
||||||
|
* deprecated passing a Twig\Template to Twig\Environment::load()/Twig\Environment::resolveTemplate()
|
||||||
* added the possibility to pass a TemplateWrapper to Twig\Environment::load()
|
* added the possibility to pass a TemplateWrapper to Twig\Environment::load()
|
||||||
* marked Twig\Environment::getTemplateClass() as internal (implementation detail)
|
* marked Twig\Environment::getTemplateClass() as internal (implementation detail)
|
||||||
* improved the performance of the sandbox
|
* improved the performance of the sandbox
|
||||||
|
|||||||
@@ -68,6 +68,10 @@ Environment
|
|||||||
* As of Twig 2.7, the ``Twig\Environment::getTemplateClass()`` is marked as
|
* As of Twig 2.7, the ``Twig\Environment::getTemplateClass()`` is marked as
|
||||||
being internal and should not be used.
|
being internal and should not be used.
|
||||||
|
|
||||||
|
* As of Twig 2.7, passing a ``Twig\Template`` instance to the
|
||||||
|
``Twig\Environment::load()`` and ``Twig\Environment::resolveTemplate()`` is
|
||||||
|
deprecated.
|
||||||
|
|
||||||
Interfaces
|
Interfaces
|
||||||
----------
|
----------
|
||||||
|
|
||||||
|
|||||||
+4
-3
@@ -29,7 +29,6 @@ use Twig\Node\ModuleNode;
|
|||||||
use Twig\Node\Node;
|
use Twig\Node\Node;
|
||||||
use Twig\NodeVisitor\NodeVisitorInterface;
|
use Twig\NodeVisitor\NodeVisitorInterface;
|
||||||
use Twig\RuntimeLoader\RuntimeLoaderInterface;
|
use Twig\RuntimeLoader\RuntimeLoaderInterface;
|
||||||
use Twig\Template;
|
|
||||||
use Twig\TokenParser\TokenParserInterface;
|
use Twig\TokenParser\TokenParserInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -338,7 +337,7 @@ class Environment
|
|||||||
/**
|
/**
|
||||||
* Loads a template.
|
* Loads a template.
|
||||||
*
|
*
|
||||||
* @param string|TemplateWrapper|Template $name The template name
|
* @param string|TemplateWrapper $name The template name
|
||||||
*
|
*
|
||||||
* @throws LoaderError When the template cannot be found
|
* @throws LoaderError When the template cannot be found
|
||||||
* @throws RuntimeError When a previously generated cache is corrupted
|
* @throws RuntimeError When a previously generated cache is corrupted
|
||||||
@@ -353,6 +352,8 @@ class Environment
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($name instanceof Template) {
|
if ($name instanceof Template) {
|
||||||
|
@trigger_error('Passing a \Twig\Template instance to '.__METHOD__.' is deprecated since Twig 2.7.0, use \Twig\TemplateWrapper instead.', E_USER_DEPRECATED);
|
||||||
|
|
||||||
return new TemplateWrapper($this, $name);
|
return new TemplateWrapper($this, $name);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -485,7 +486,7 @@ class Environment
|
|||||||
* Similar to load() but it also accepts instances of \Twig\Template and
|
* Similar to load() but it also accepts instances of \Twig\Template and
|
||||||
* \Twig\TemplateWrapper, and an array of templates where each is tried to be loaded.
|
* \Twig\TemplateWrapper, and an array of templates where each is tried to be loaded.
|
||||||
*
|
*
|
||||||
* @param string|Template|TemplateWrapper|array $names A template or an array of templates to try consecutively
|
* @param string|TemplateWrapper|array $names A template or an array of templates to try consecutively
|
||||||
*
|
*
|
||||||
* @return TemplateWrapper
|
* @return TemplateWrapper
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -11,7 +11,6 @@
|
|||||||
|
|
||||||
use Twig\Environment;
|
use Twig\Environment;
|
||||||
use Twig\Loader\ArrayLoader;
|
use Twig\Loader\ArrayLoader;
|
||||||
use Twig\TemplateWrapper;
|
|
||||||
|
|
||||||
class Twig_Tests_TemplateWrapperTest extends \PHPUnit\Framework\TestCase
|
class Twig_Tests_TemplateWrapperTest extends \PHPUnit\Framework\TestCase
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user