feature #2481 Mark Twig_Node_Module as final via an annotation (will be final in 3.0) (fabpot)

This PR was squashed before being merged into the 2.x branch (closes #2481).

Discussion
----------

Mark Twig_Node_Module as final via an annotation (will be final in 3.0)

Commits
-------

e5fb21f1 added deprecation notices for @final classes
93929e1d added @final classes in the deprecated document
3810368b marked Twig_Node_Module as final via an annotation (will be final in 3.0)
This commit is contained in:
Fabien Potencier
2017-05-24 07:59:35 +02:00
8 changed files with 36 additions and 8 deletions
+2 -2
View File
@@ -1,6 +1,6 @@
* 2.3.3 (2017-XX-XX)
* 2.4.0 (2017-XX-XX)
* n/a
* marked Twig_Node_Module as final via the @final annotation
* 2.3.2 (2017-04-20)
+1 -1
View File
@@ -47,7 +47,7 @@
},
"extra": {
"branch-alias": {
"dev-master": "2.3-dev"
"dev-master": "2.4-dev"
}
}
}
+11 -1
View File
@@ -5,4 +5,14 @@ This document lists deprecated features in Twig 2.x. Deprecated features are
kept for backward compatibility and removed in the next major release (a
feature that was deprecated in Twig 2.x is removed in Twig 3.0).
There are no deprecated features for Twig 2.x.
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``
+4 -4
View File
@@ -16,11 +16,11 @@
*/
class Twig_Environment
{
const VERSION = '2.3.3-DEV';
const VERSION_ID = 20303;
const VERSION = '2.4.0-DEV';
const VERSION_ID = 20400;
const MAJOR_VERSION = 2;
const MINOR_VERSION = 3;
const RELEASE_VERSION = 3;
const MINOR_VERSION = 4;
const RELEASE_VERSION = 0;
const EXTRA_VERSION = 'DEV';
private $charset;
+4
View File
@@ -34,6 +34,10 @@ class Twig_Filter
*/
public function __construct(string $name, $callable = null, array $options = array())
{
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);
}
$this->name = $name;
$this->callable = $callable;
$this->options = array_merge(array(
+6
View File
@@ -18,6 +18,8 @@
* display_end, constructor_start, constructor_end, and class_end.
*
* @author Fabien Potencier <fabien@symfony.com>
*
* @final since 2.4.0
*/
class Twig_Node_Module extends Twig_Node
{
@@ -25,6 +27,10 @@ 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);
}
$this->source = $source;
$nodes = array(
+4
View File
@@ -30,6 +30,10 @@ 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);
}
$this->template = $template;
$this->type = $type;
$this->name = 0 === strpos($name, '__internal_') ? 'INTERNAL' : $name;
+4
View File
@@ -33,6 +33,10 @@ class Twig_Test
*/
public function __construct(string $name, $callable = null, array $options = array())
{
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);
}
$this->name = $name;
$this->callable = $callable;
$this->options = array_merge(array(