From e8a21cfe97687b89c38655f3904c551cdacbae24 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Tue, 23 Apr 2019 17:10:12 +0200 Subject: [PATCH] changed classes marked as @final to final --- src/Node/ModuleNode.php | 8 +------- src/Profiler/Profile.php | 8 +------- src/Sandbox/SecurityNotAllowedFilterError.php | 4 +--- src/Sandbox/SecurityNotAllowedFunctionError.php | 4 +--- src/Sandbox/SecurityNotAllowedMethodError.php | 4 +--- src/Sandbox/SecurityNotAllowedPropertyError.php | 4 +--- src/Sandbox/SecurityNotAllowedTagError.php | 4 +--- src/TokenParser/DeprecatedTokenParser.php | 4 +--- src/TwigFilter.php | 8 +------- src/TwigFunction.php | 8 +------- src/TwigTest.php | 8 +------- 11 files changed, 11 insertions(+), 53 deletions(-) diff --git a/src/Node/ModuleNode.php b/src/Node/ModuleNode.php index 2b8999f47..a9709ff5d 100644 --- a/src/Node/ModuleNode.php +++ b/src/Node/ModuleNode.php @@ -25,17 +25,11 @@ use Twig\Source; * display_end, constructor_start, constructor_end, and class_end. * * @author Fabien Potencier - * - * @final since Twig 2.4.0 */ -class ModuleNode extends Node +final class ModuleNode extends Node { public function __construct(Node $body, AbstractExpression $parent = null, Node $blocks, Node $macros, Node $traits, $embeddedTemplates, Source $source) { - if (__CLASS__ !== \get_class($this)) { - @trigger_error('Overriding '.__CLASS__.' is deprecated since Twig 2.4.0 and the class will be final in 3.0.', E_USER_DEPRECATED); - } - $nodes = [ 'body' => $body, 'blocks' => $blocks, diff --git a/src/Profiler/Profile.php b/src/Profiler/Profile.php index c6825135f..5e032e370 100644 --- a/src/Profiler/Profile.php +++ b/src/Profiler/Profile.php @@ -13,10 +13,8 @@ namespace Twig\Profiler; /** * @author Fabien Potencier - * - * @final since Twig 2.4.0 */ -class Profile implements \IteratorAggregate, \Serializable +final class Profile implements \IteratorAggregate, \Serializable { const ROOT = 'ROOT'; const BLOCK = 'block'; @@ -32,10 +30,6 @@ class Profile implements \IteratorAggregate, \Serializable public function __construct(string $template = 'main', string $type = self::ROOT, string $name = 'main') { - if (__CLASS__ !== \get_class($this)) { - @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; $this->type = $type; $this->name = 0 === strpos($name, '__internal_') ? 'INTERNAL' : $name; diff --git a/src/Sandbox/SecurityNotAllowedFilterError.php b/src/Sandbox/SecurityNotAllowedFilterError.php index 04561c2a7..8718a3d71 100644 --- a/src/Sandbox/SecurityNotAllowedFilterError.php +++ b/src/Sandbox/SecurityNotAllowedFilterError.php @@ -15,10 +15,8 @@ namespace Twig\Sandbox; * Exception thrown when a not allowed filter is used in a template. * * @author Martin Hasoň - * - * @final */ -class SecurityNotAllowedFilterError extends SecurityError +final class SecurityNotAllowedFilterError extends SecurityError { private $filterName; diff --git a/src/Sandbox/SecurityNotAllowedFunctionError.php b/src/Sandbox/SecurityNotAllowedFunctionError.php index b9428f531..171a316cc 100644 --- a/src/Sandbox/SecurityNotAllowedFunctionError.php +++ b/src/Sandbox/SecurityNotAllowedFunctionError.php @@ -15,10 +15,8 @@ namespace Twig\Sandbox; * Exception thrown when a not allowed function is used in a template. * * @author Martin Hasoň - * - * @final */ -class SecurityNotAllowedFunctionError extends SecurityError +final class SecurityNotAllowedFunctionError extends SecurityError { private $functionName; diff --git a/src/Sandbox/SecurityNotAllowedMethodError.php b/src/Sandbox/SecurityNotAllowedMethodError.php index ebbc40451..40d550ee3 100644 --- a/src/Sandbox/SecurityNotAllowedMethodError.php +++ b/src/Sandbox/SecurityNotAllowedMethodError.php @@ -15,10 +15,8 @@ namespace Twig\Sandbox; * Exception thrown when a not allowed class method is used in a template. * * @author Kit Burton-Senior - * - * @final */ -class SecurityNotAllowedMethodError extends SecurityError +final class SecurityNotAllowedMethodError extends SecurityError { private $className; private $methodName; diff --git a/src/Sandbox/SecurityNotAllowedPropertyError.php b/src/Sandbox/SecurityNotAllowedPropertyError.php index 4c1c67e76..3c03a3f39 100644 --- a/src/Sandbox/SecurityNotAllowedPropertyError.php +++ b/src/Sandbox/SecurityNotAllowedPropertyError.php @@ -15,10 +15,8 @@ namespace Twig\Sandbox; * Exception thrown when a not allowed class property is used in a template. * * @author Kit Burton-Senior - * - * @final */ -class SecurityNotAllowedPropertyError extends SecurityError +final class SecurityNotAllowedPropertyError extends SecurityError { private $className; private $propertyName; diff --git a/src/Sandbox/SecurityNotAllowedTagError.php b/src/Sandbox/SecurityNotAllowedTagError.php index c19378acf..4af09e87e 100644 --- a/src/Sandbox/SecurityNotAllowedTagError.php +++ b/src/Sandbox/SecurityNotAllowedTagError.php @@ -15,10 +15,8 @@ namespace Twig\Sandbox; * Exception thrown when a not allowed tag is used in a template. * * @author Martin Hasoň - * - * @final */ -class SecurityNotAllowedTagError extends SecurityError +final class SecurityNotAllowedTagError extends SecurityError { private $tagName; diff --git a/src/TokenParser/DeprecatedTokenParser.php b/src/TokenParser/DeprecatedTokenParser.php index e5d1fb3c5..0e865c674 100644 --- a/src/TokenParser/DeprecatedTokenParser.php +++ b/src/TokenParser/DeprecatedTokenParser.php @@ -21,10 +21,8 @@ use Twig\Token; * {% extends 'layout.html.twig' %} * * @author Yonel Ceruto - * - * @final */ -class DeprecatedTokenParser extends AbstractTokenParser +final class DeprecatedTokenParser extends AbstractTokenParser { public function parse(Token $token) { diff --git a/src/TwigFilter.php b/src/TwigFilter.php index 029815c98..8310b8905 100644 --- a/src/TwigFilter.php +++ b/src/TwigFilter.php @@ -17,13 +17,11 @@ use Twig\Node\Node; /** * Represents a template filter. * - * @final since Twig 2.4.0 - * * @author Fabien Potencier * * @see https://twig.symfony.com/doc/templates.html#filters */ -class TwigFilter +final class TwigFilter { private $name; private $callable; @@ -39,10 +37,6 @@ class TwigFilter */ public function __construct(string $name, $callable = null, array $options = []) { - if (__CLASS__ !== \get_class($this)) { - @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; $this->callable = $callable; $this->options = array_merge([ diff --git a/src/TwigFunction.php b/src/TwigFunction.php index 710c6d40c..a4e728b4c 100644 --- a/src/TwigFunction.php +++ b/src/TwigFunction.php @@ -17,13 +17,11 @@ use Twig\Node\Node; /** * Represents a template function. * - * @final - * * @author Fabien Potencier * * @see https://twig.symfony.com/doc/templates.html#functions */ -class TwigFunction +final class TwigFunction { private $name; private $callable; @@ -39,10 +37,6 @@ class TwigFunction */ public function __construct(string $name, $callable = null, array $options = []) { - if (__CLASS__ !== \get_class($this)) { - @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; $this->callable = $callable; $this->options = array_merge([ diff --git a/src/TwigTest.php b/src/TwigTest.php index e6624f3ac..4cbe273be 100644 --- a/src/TwigTest.php +++ b/src/TwigTest.php @@ -16,13 +16,11 @@ use Twig\Node\Expression\TestExpression; /** * Represents a template test. * - * @final since Twig 2.4.0 - * * @author Fabien Potencier * * @see https://twig.symfony.com/doc/templates.html#test-operator */ -class TwigTest +final class TwigTest { private $name; private $callable; @@ -38,10 +36,6 @@ class TwigTest */ public function __construct(string $name, $callable = null, array $options = []) { - if (__CLASS__ !== \get_class($this)) { - @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; $this->callable = $callable; $this->options = array_merge([