minor #15113 [2.8][DependencyInjection] improve deprecation messages (xabbuh)
This PR was merged into the 2.8 branch.
Discussion
----------
[2.8][DependencyInjection] improve deprecation messages
| Q | A
| ------------- | ---
| Bug fix? | no
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets |
| License | MIT
| Doc PR |
Also include the service id in the deprecation message.
Commits
-------
d144dbb
[DependencyInjection] improve deprecation messages
This commit is contained in:
commit
03e96d24f3
|
@ -162,7 +162,7 @@ class XmlFileLoader extends FileLoader
|
|||
$triggerDeprecation = 'request' !== (string) $service->getAttribute('id');
|
||||
|
||||
if ($triggerDeprecation) {
|
||||
@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);
|
||||
@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);
|
||||
}
|
||||
|
||||
$definition->setScope(XmlUtils::phpize($value), false);
|
||||
|
|
|
@ -169,7 +169,7 @@ class YamlFileLoader extends FileLoader
|
|||
|
||||
if (isset($service['scope'])) {
|
||||
if ('request' !== $id) {
|
||||
@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);
|
||||
@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);
|
||||
}
|
||||
$definition->setScope($service['scope'], false);
|
||||
}
|
||||
|
|
Reference in New Issue