mirror of
https://github.com/twigphp/Twig.git
synced 2026-09-15 03:46:39 +00:00
deprecated passing a string as a source on Twig_Error
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
* 2.6.1 (2018-XX-XX)
|
||||
|
||||
* deprecated passing a string as a source on Twig_Error
|
||||
* switched generated code to use the PHP short array notation
|
||||
|
||||
* 2.6.0 (2018-12-16)
|
||||
|
||||
@@ -13,6 +13,12 @@ Inheritance
|
||||
``Twig_Error_Syntax`` exception. It does not work anyway, so most projects
|
||||
won't need to do anything to upgrade.
|
||||
|
||||
Errors
|
||||
------
|
||||
|
||||
* Passing a string as the ``$source`` argument on ``Twig_Error`` constructor is
|
||||
deprecated since Twig 2.6.1. Pass an instance of ``Twig_Source`` instead.
|
||||
|
||||
Tags
|
||||
----
|
||||
|
||||
|
||||
+1
-1
@@ -63,7 +63,7 @@ class Twig_Error extends Exception
|
||||
if (null === $source) {
|
||||
$name = null;
|
||||
} elseif (!$source instanceof Twig_Source) {
|
||||
// for compat with the Twig C ext., passing the template name as string is accepted
|
||||
@trigger_error(sprintf('Passing a string as a source to %s is deprecated since version 2.6.1; pass a Twig_Source instance instead.', __CLASS__), E_USER_DEPRECATED);
|
||||
$name = $source;
|
||||
} else {
|
||||
$name = $source->getName();
|
||||
|
||||
@@ -206,9 +206,9 @@ abstract class Twig_Template
|
||||
} elseif (false !== $parent = $this->getParent($context)) {
|
||||
$parent->displayBlock($name, $context, array_merge($this->blocks, $blocks), false);
|
||||
} elseif (isset($blocks[$name])) {
|
||||
throw new Twig_Error_Runtime(sprintf('Block "%s" should not call parent() in "%s" as the block does not exist in the parent template "%s".', $name, $blocks[$name][0]->getTemplateName(), $this->getTemplateName()), -1, $blocks[$name][0]->getTemplateName());
|
||||
throw new Twig_Error_Runtime(sprintf('Block "%s" should not call parent() in "%s" as the block does not exist in the parent template "%s".', $name, $blocks[$name][0]->getTemplateName(), $this->getTemplateName()), -1, $blocks[$name][0]->getSourceContext());
|
||||
} else {
|
||||
throw new Twig_Error_Runtime(sprintf('Block "%s" on template "%s" does not exist.', $name, $this->getTemplateName()), -1, $this->getTemplateName());
|
||||
throw new Twig_Error_Runtime(sprintf('Block "%s" on template "%s" does not exist.', $name, $this->getTemplateName()), -1, $this->getSourceContext());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user