[DependencyInjection] Don't store default deprecation template in every service definition instance

This commit is contained in:
Alan Bondarchuk 2017-05-04 20:21:54 +03:00
parent 1f1b5d4f9e
commit 388ee467c5

View File

@ -29,7 +29,7 @@ class Definition
private $factoryService;
private $shared = true;
private $deprecated = false;
private $deprecationTemplate = 'The "%service_id%" service is deprecated. You should stop using it, as it will soon be removed.';
private $deprecationTemplate;
private $scope = ContainerInterface::SCOPE_CONTAINER;
private $properties = array();
private $calls = array();
@ -44,6 +44,8 @@ class Definition
private $autowired = false;
private $autowiringTypes = array();
private static $defaultDeprecationTemplate = 'The "%service_id%" service is deprecated. You should stop using it, as it will soon be removed.';
protected $arguments;
/**
@ -796,7 +798,7 @@ class Definition
*/
public function getDeprecationMessage($id)
{
return str_replace('%service_id%', $id, $this->deprecationTemplate);
return str_replace('%service_id%', $id, $this->deprecationTemplate ?: self::$defaultDeprecationTemplate);
}
/**