Skip to content

Commit c94d110

Browse files
committed
[DependencyInjection] Don't store default deprecation template in every service definition instance
1 parent e1c722d commit c94d110

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

Definition.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class Definition
2929
private $factoryService;
3030
private $shared = true;
3131
private $deprecated = false;
32-
private $deprecationTemplate = 'The "%service_id%" service is deprecated. You should stop using it, as it will soon be removed.';
32+
private $deprecationTemplate;
3333
private $scope = ContainerInterface::SCOPE_CONTAINER;
3434
private $properties = array();
3535
private $calls = array();
@@ -44,6 +44,8 @@ class Definition
4444
private $autowired = false;
4545
private $autowiringTypes = array();
4646

47+
private static $defaultDeprecationTemplate = 'The "%service_id%" service is deprecated. You should stop using it, as it will soon be removed.';
48+
4749
protected $arguments;
4850

4951
/**
@@ -796,7 +798,7 @@ public function isDeprecated()
796798
*/
797799
public function getDeprecationMessage($id)
798800
{
799-
return str_replace('%service_id%', $id, $this->deprecationTemplate);
801+
return str_replace('%service_id%', $id, $this->deprecationTemplate ?: self::$defaultDeprecationTemplate);
800802
}
801803

802804
/**

0 commit comments

Comments
 (0)