mirror of
https://github.com/twigphp/Twig.git
synced 2026-09-14 11:27:00 +00:00
tweaked deprecations
This commit is contained in:
+11
-10
@@ -10,21 +10,22 @@ Inheritance
|
||||
|
||||
* Defining a "block" definition in a non-capturing block in a child template is
|
||||
deprecated since Twig 2.5.0. In Twig 3.0, it will throw a
|
||||
``Twig_Error_Syntax`` exception. It does not work anyway, so most projects
|
||||
won't need to do anything to upgrade.
|
||||
``Twig\Error\SyntaxError`` 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.
|
||||
* Passing a string as the ``$source`` argument on ``Twig\Error\Error``
|
||||
constructor is deprecated since Twig 2.6.1. Pass an instance of
|
||||
``Twig\Source`` instead.
|
||||
|
||||
Tags
|
||||
----
|
||||
|
||||
* Using the ``spaceless`` tag at the root level of a child template is
|
||||
deprecated in Twig 2.5.0. This does not work as one would expect it to work
|
||||
anyway. In Twig 3.0, it will throw a ``Twig_Error_Syntax`` exception.
|
||||
anyway. In Twig 3.0, it will throw a ``Twig\Error\SyntaxError`` exception.
|
||||
|
||||
Final Classes
|
||||
-------------
|
||||
@@ -32,8 +33,8 @@ Final Classes
|
||||
The following classes are marked as ``@final`` in Twig 2 and will be final in
|
||||
3.0:
|
||||
|
||||
* ``Twig_Node_Module``
|
||||
* ``Twig_Filter``
|
||||
* ``Twig_Function``
|
||||
* ``Twig_Test``
|
||||
* ``Twig_Profiler_Profile``
|
||||
* ``Twig\Node\ModuleNode``
|
||||
* ``Twig\TwigFilter``
|
||||
* ``Twig\TwigFunction``
|
||||
* ``Twig\TwigTest``
|
||||
* ``Twig\Profiler\Profile``
|
||||
|
||||
+1
-1
@@ -63,7 +63,7 @@ class Twig_Error extends Exception
|
||||
if (null === $source) {
|
||||
$name = null;
|
||||
} elseif (!$source instanceof Twig_Source) {
|
||||
@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);
|
||||
@trigger_error(sprintf('Passing a string as a source to %s is deprecated since Twig 2.6.1; pass a Twig\Source instance instead.', __CLASS__), E_USER_DEPRECATED);
|
||||
$name = $source;
|
||||
} else {
|
||||
$name = $source->getName();
|
||||
|
||||
+1
-1
@@ -35,7 +35,7 @@ class Twig_Filter
|
||||
public function __construct(string $name, $callable = null, array $options = [])
|
||||
{
|
||||
if (__CLASS__ !== get_class($this)) {
|
||||
@trigger_error('Overriding '.__CLASS__.' is deprecated since version 2.4.0 and the class will be final in 3.0.', E_USER_DEPRECATED);
|
||||
@trigger_error('Overriding '.__CLASS__.' is deprecated since Twig 2.4.0 and the class will be final in 3.0.', E_USER_DEPRECATED);
|
||||
}
|
||||
|
||||
$this->name = $name;
|
||||
|
||||
@@ -35,7 +35,7 @@ class Twig_Function
|
||||
public function __construct(string $name, $callable = null, array $options = [])
|
||||
{
|
||||
if (__CLASS__ !== get_class($this)) {
|
||||
@trigger_error('Overriding '.__CLASS__.' is deprecated since version 2.4.0 and the class will be final in 3.0.', E_USER_DEPRECATED);
|
||||
@trigger_error('Overriding '.__CLASS__.' is deprecated since Twig 2.4.0 and the class will be final in 3.0.', E_USER_DEPRECATED);
|
||||
}
|
||||
|
||||
$this->name = $name;
|
||||
|
||||
@@ -28,7 +28,7 @@ class Twig_Node_Module extends Twig_Node
|
||||
public function __construct(Twig_Node $body, Twig_Node_Expression $parent = null, Twig_Node $blocks, Twig_Node $macros, Twig_Node $traits, $embeddedTemplates, Twig_Source $source)
|
||||
{
|
||||
if (__CLASS__ !== get_class($this)) {
|
||||
@trigger_error('Overriding '.__CLASS__.' is deprecated since version 2.4.0 and the class will be final in 3.0.', E_USER_DEPRECATED);
|
||||
@trigger_error('Overriding '.__CLASS__.' is deprecated since Twig 2.4.0 and the class will be final in 3.0.', E_USER_DEPRECATED);
|
||||
}
|
||||
|
||||
$this->source = $source;
|
||||
|
||||
+2
-2
@@ -341,7 +341,7 @@ class Twig_Parser
|
||||
|
||||
// to be removed completely in Twig 3.0
|
||||
if (!$nested && $node instanceof Twig_Node_Spaceless) {
|
||||
@trigger_error(sprintf('Using the spaceless tag at the root level of a child template in "%s" at line %d is deprecated since version 2.5.0 and will become a syntax error in 3.0.', $this->stream->getSourceContext()->getName(), $node->getTemplateLine()), E_USER_DEPRECATED);
|
||||
@trigger_error(sprintf('Using the spaceless tag at the root level of a child template in "%s" at line %d is deprecated since Twig 2.5.0 and will become a syntax error in 3.0.', $this->stream->getSourceContext()->getName(), $node->getTemplateLine()), E_USER_DEPRECATED);
|
||||
}
|
||||
|
||||
// "block" tags that are not captured (see above) are only used for defining
|
||||
@@ -349,7 +349,7 @@ class Twig_Parser
|
||||
// expected as the definition is not part of the default template code flow.
|
||||
if ($nested && $node instanceof Twig_Node_BlockReference) {
|
||||
//throw new Twig_Error_Syntax('A block definition cannot be nested under non-capturing nodes.', $node->getTemplateLine(), $this->stream->getSourceContext());
|
||||
@trigger_error(sprintf('Nesting a block definition under a non-capturing node in "%s" at line %d is deprecated since version 2.5.0 and will become a syntax error in 3.0.', $this->stream->getSourceContext()->getName(), $node->getTemplateLine()), E_USER_DEPRECATED);
|
||||
@trigger_error(sprintf('Nesting a block definition under a non-capturing node in "%s" at line %d is deprecated since Twig 2.5.0 and will become a syntax error in 3.0.', $this->stream->getSourceContext()->getName(), $node->getTemplateLine()), E_USER_DEPRECATED);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ class Twig_Profiler_Profile implements IteratorAggregate, Serializable
|
||||
public function __construct($template = 'main', $type = self::ROOT, $name = 'main')
|
||||
{
|
||||
if (__CLASS__ !== get_class($this)) {
|
||||
@trigger_error('Overriding '.__CLASS__.' is deprecated since version 2.4.0 and the class will be final in 3.0.', E_USER_DEPRECATED);
|
||||
@trigger_error('Overriding '.__CLASS__.' is deprecated since Twig 2.4.0 and the class will be final in 3.0.', E_USER_DEPRECATED);
|
||||
}
|
||||
|
||||
$this->template = $template;
|
||||
|
||||
+1
-1
@@ -35,7 +35,7 @@ class Twig_Test
|
||||
public function __construct(string $name, $callable = null, array $options = [])
|
||||
{
|
||||
if (__CLASS__ !== get_class($this)) {
|
||||
@trigger_error('Overriding '.__CLASS__.' is deprecated since version 2.4.0 and the class will be final in 3.0.', E_USER_DEPRECATED);
|
||||
@trigger_error('Overriding '.__CLASS__.' is deprecated since Twig 2.4.0 and the class will be final in 3.0.', E_USER_DEPRECATED);
|
||||
}
|
||||
|
||||
$this->name = $name;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
--TEST--
|
||||
conditional "block" tag with "extends" tag
|
||||
--DEPRECATION--
|
||||
Nesting a block definition under a non-capturing node in "index.twig" at line 5 is deprecated since version 2.5.0 and will become a syntax error in 3.0.
|
||||
Nesting a block definition under a non-capturing node in "index.twig" at line 5 is deprecated since Twig 2.5.0 and will become a syntax error in 3.0.
|
||||
--TEMPLATE--
|
||||
{% extends "layout.twig" %}
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
--TEST--
|
||||
"spaceless" tag in the root level of a child template
|
||||
--DEPRECATION--
|
||||
Using the spaceless tag at the root level of a child template in "index.twig" at line 3 is deprecated since version 2.5.0 and will become a syntax error in 3.0.
|
||||
Nesting a block definition under a non-capturing node in "index.twig" at line 4 is deprecated since version 2.5.0 and will become a syntax error in 3.0.
|
||||
Using the spaceless tag at the root level of a child template in "index.twig" at line 3 is deprecated since Twig 2.5.0 and will become a syntax error in 3.0.
|
||||
Nesting a block definition under a non-capturing node in "index.twig" at line 4 is deprecated since Twig 2.5.0 and will become a syntax error in 3.0.
|
||||
--TEMPLATE--
|
||||
{% extends "layout.twig" %}
|
||||
{% spaceless %}
|
||||
|
||||
Reference in New Issue
Block a user