added the possibility to pass a TemplateWrapper to Twig\Environment::load()

This commit is contained in:
Fabien Potencier
2019-03-11 17:54:51 +01:00
parent eb89971925
commit c82d7dcaab
2 changed files with 7 additions and 6 deletions
+1
View File
@@ -1,5 +1,6 @@
* 1.38.0 (2019-XX-XX) * 1.38.0 (2019-XX-XX)
* added the possibility to pass a TemplateWrapper to Twig\Environment::load()
* improved the performance of the sandbox * improved the performance of the sandbox
* added a spaceless filter * added a spaceless filter
* added max value to the "random" function * added max value to the "random" function
+6 -6
View File
@@ -371,8 +371,8 @@ class Environment
/** /**
* Renders a template. * Renders a template.
* *
* @param string $name The template name * @param string|TemplateWrapper $name The template name
* @param array $context An array of parameters to pass to the template * @param array $context An array of parameters to pass to the template
* *
* @return string The rendered template * @return string The rendered template
* *
@@ -382,14 +382,14 @@ class Environment
*/ */
public function render($name, array $context = []) public function render($name, array $context = [])
{ {
return $this->loadTemplate($name)->render($context); return $this->load($name)->render($context);
} }
/** /**
* Displays a template. * Displays a template.
* *
* @param string $name The template name * @param string|TemplateWrapper $name The template name
* @param array $context An array of parameters to pass to the template * @param array $context An array of parameters to pass to the template
* *
* @throws LoaderError When the template cannot be found * @throws LoaderError When the template cannot be found
* @throws SyntaxError When an error occurred during compilation * @throws SyntaxError When an error occurred during compilation
@@ -397,7 +397,7 @@ class Environment
*/ */
public function display($name, array $context = []) public function display($name, array $context = [])
{ {
$this->loadTemplate($name)->display($context); $this->load($name)->display($context);
} }
/** /**