deprecated passing a Twig\Template to load()/resolveTemplate()

This commit is contained in:
Fabien Potencier
2019-03-11 18:59:16 +01:00
parent a4476dfc78
commit b5da9b5aa7
4 changed files with 9 additions and 4 deletions
+4 -3
View File
@@ -29,7 +29,6 @@ use Twig\Node\ModuleNode;
use Twig\Node\Node;
use Twig\NodeVisitor\NodeVisitorInterface;
use Twig\RuntimeLoader\RuntimeLoaderInterface;
use Twig\Template;
use Twig\TokenParser\TokenParserInterface;
/**
@@ -338,7 +337,7 @@ class Environment
/**
* 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 RuntimeError When a previously generated cache is corrupted
@@ -353,6 +352,8 @@ class Environment
}
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);
}
@@ -485,7 +486,7 @@ class Environment
* 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.
*
* @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
*