Skip to content

Commit 844a92b

Browse files
committed
[DependencyInjection] improve deprecation messages
Also include the service id in the deprecation message.
1 parent 4da1865 commit 844a92b

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

Loader/XmlFileLoader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ private function parseDefinition(\DOMElement $service, $file)
162162
$triggerDeprecation = 'request' !== (string) $service->getAttribute('id');
163163

164164
if ($triggerDeprecation) {
165-
@trigger_error(sprintf('The "scope" attribute in file "%s" is deprecated since version 2.8 and will be removed in 3.0.', $file), E_USER_DEPRECATED);
165+
@trigger_error(sprintf('The "scope" attribute of service "%s" in file "%s" is deprecated since version 2.8 and will be removed in 3.0.', (string) $service->getAttribute('id'), $file), E_USER_DEPRECATED);
166166
}
167167

168168
$definition->setScope(XmlUtils::phpize($value), false);

Loader/YamlFileLoader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ private function parseDefinition($id, $service, $file)
169169

170170
if (isset($service['scope'])) {
171171
if ('request' !== $id) {
172-
@trigger_error(sprintf('The "scope" key in file "%s" is deprecated since version 2.8 and will be removed in 3.0.', $file), E_USER_DEPRECATED);
172+
@trigger_error(sprintf('The "scope" key of service "%s" in file "%s" is deprecated since version 2.8 and will be removed in 3.0.', $id, $file), E_USER_DEPRECATED);
173173
}
174174
$definition->setScope($service['scope'], false);
175175
}

0 commit comments

Comments
 (0)