From 936e399ff9c30e621c8dcaa9b1bd54d4897e4a0c Mon Sep 17 00:00:00 2001 From: "Alexander M. Turek" Date: Thu, 1 Jul 2021 23:28:50 +0200 Subject: [PATCH] [DependencyInjection] Turn $defaultDeprecationTemplate into a constant Signed-off-by: Alexander M. Turek --- src/Symfony/Component/DependencyInjection/Alias.php | 6 +++--- src/Symfony/Component/DependencyInjection/Definition.php | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Symfony/Component/DependencyInjection/Alias.php b/src/Symfony/Component/DependencyInjection/Alias.php index 3e74fd92c8..ca8a45a69c 100644 --- a/src/Symfony/Component/DependencyInjection/Alias.php +++ b/src/Symfony/Component/DependencyInjection/Alias.php @@ -15,14 +15,14 @@ use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException; class Alias { + private const DEFAULT_DEPRECATION_TEMPLATE = 'The "%alias_id%" service alias is deprecated. You should stop using it, as it will be removed in the future.'; + private $id; private $public; private $private; private $deprecated; private $deprecationTemplate; - private static $defaultDeprecationTemplate = 'The "%alias_id%" service alias is deprecated. You should stop using it, as it will be removed in the future.'; - public function __construct(string $id, bool $public = true) { $this->id = $id; @@ -122,7 +122,7 @@ class Alias public function getDeprecationMessage(string $id): string { - return str_replace('%alias_id%', $id, $this->deprecationTemplate ?: self::$defaultDeprecationTemplate); + return str_replace('%alias_id%', $id, $this->deprecationTemplate ?: self::DEFAULT_DEPRECATION_TEMPLATE); } /** diff --git a/src/Symfony/Component/DependencyInjection/Definition.php b/src/Symfony/Component/DependencyInjection/Definition.php index 9ce01cea47..4b3cf31938 100644 --- a/src/Symfony/Component/DependencyInjection/Definition.php +++ b/src/Symfony/Component/DependencyInjection/Definition.php @@ -22,6 +22,8 @@ use Symfony\Component\DependencyInjection\Exception\OutOfBoundsException; */ class Definition { + private const DEFAULT_DEPRECATION_TEMPLATE = 'The "%service_id%" service is deprecated. You should stop using it, as it will be removed in the future.'; + private $class; private $file; private $factory; @@ -47,8 +49,6 @@ class Definition protected $arguments = []; - private static $defaultDeprecationTemplate = 'The "%service_id%" service is deprecated. You should stop using it, as it will be removed in the future.'; - /** * @internal * @@ -799,7 +799,7 @@ class Definition */ public function getDeprecationMessage($id) { - return str_replace('%service_id%', $id, $this->deprecationTemplate ?: self::$defaultDeprecationTemplate); + return str_replace('%service_id%', $id, $this->deprecationTemplate ?: self::DEFAULT_DEPRECATION_TEMPLATE); } /**