[DependencyInjection] improve deprecation messages
Also include the service id in the deprecation message.
This commit is contained in:
parent
a0af4ef1bf
commit
9e41fa7852
@ -151,7 +151,7 @@ class XmlFileLoader extends FileLoader
|
||||
foreach (array('class', 'scope', 'public', 'factory-class', 'factory-method', 'factory-service', 'synthetic', 'lazy', 'abstract') as $key) {
|
||||
if ($value = $service->getAttribute($key)) {
|
||||
if (in_array($key, array('factory-class', 'factory-method', 'factory-service'))) {
|
||||
@trigger_error(sprintf('The "%s" attribute in file "%s" is deprecated since version 2.6 and will be removed in 3.0. Use the "factory" element instead.', $key, $file), E_USER_DEPRECATED);
|
||||
@trigger_error(sprintf('The "%s" attribute of service "%s" in file "%s" is deprecated since version 2.6 and will be removed in 3.0. Use the "factory" element instead.', $key, (string) $service->getAttribute('id'), $file), E_USER_DEPRECATED);
|
||||
}
|
||||
$method = 'set'.str_replace('-', '', $key);
|
||||
$definition->$method(XmlUtils::phpize($value));
|
||||
@ -162,7 +162,7 @@ class XmlFileLoader extends FileLoader
|
||||
$triggerDeprecation = 'request' !== (string) $service->getAttribute('id');
|
||||
|
||||
if ($triggerDeprecation) {
|
||||
@trigger_error(sprintf('The "synchronized" attribute in file "%s" is deprecated since version 2.7 and will be removed in 3.0.', $file), E_USER_DEPRECATED);
|
||||
@trigger_error(sprintf('The "synchronized" attribute of service "%s" in file "%s" is deprecated since version 2.7 and will be removed in 3.0.', (string) $service->getAttribute('id'), $file), E_USER_DEPRECATED);
|
||||
}
|
||||
|
||||
$definition->setSynchronized(XmlUtils::phpize($value), $triggerDeprecation);
|
||||
|
@ -172,7 +172,7 @@ class YamlFileLoader extends FileLoader
|
||||
}
|
||||
|
||||
if (isset($service['synchronized'])) {
|
||||
@trigger_error(sprintf('The "synchronized" key in file "%s" is deprecated since version 2.7 and will be removed in 3.0.', $file), E_USER_DEPRECATED);
|
||||
@trigger_error(sprintf('The "synchronized" key of service "%s" in file "%s" is deprecated since version 2.7 and will be removed in 3.0.', $id, $file), E_USER_DEPRECATED);
|
||||
$definition->setSynchronized($service['synchronized'], 'request' !== $id);
|
||||
}
|
||||
|
||||
@ -202,17 +202,17 @@ class YamlFileLoader extends FileLoader
|
||||
}
|
||||
|
||||
if (isset($service['factory_class'])) {
|
||||
@trigger_error(sprintf('The "factory_class" key in file "%s" is deprecated since version 2.6 and will be removed in 3.0. Use "factory" instead.', $file), E_USER_DEPRECATED);
|
||||
@trigger_error(sprintf('The "factory_class" key of service "%s" in file "%s" is deprecated since version 2.6 and will be removed in 3.0. Use "factory" instead.', $id, $file), E_USER_DEPRECATED);
|
||||
$definition->setFactoryClass($service['factory_class']);
|
||||
}
|
||||
|
||||
if (isset($service['factory_method'])) {
|
||||
@trigger_error(sprintf('The "factory_method" key in file "%s" is deprecated since version 2.6 and will be removed in 3.0. Use "factory" instead.', $file), E_USER_DEPRECATED);
|
||||
@trigger_error(sprintf('The "factory_method" key of service "%s" in file "%s" is deprecated since version 2.6 and will be removed in 3.0. Use "factory" instead.', $id, $file), E_USER_DEPRECATED);
|
||||
$definition->setFactoryMethod($service['factory_method']);
|
||||
}
|
||||
|
||||
if (isset($service['factory_service'])) {
|
||||
@trigger_error(sprintf('The "factory_service" key in file "%s" is deprecated since version 2.6 and will be removed in 3.0. Use "factory" instead.', $file), E_USER_DEPRECATED);
|
||||
@trigger_error(sprintf('The "factory_service" key of service "%s" in file "%s" is deprecated since version 2.6 and will be removed in 3.0. Use "factory" instead.', $id, $file), E_USER_DEPRECATED);
|
||||
$definition->setFactoryService($service['factory_service']);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user