Improved the deprecation messages for service aliases
This commit is contained in:
parent
a4a68bc56c
commit
b1b21bf43d
@ -505,13 +505,13 @@ EOF
|
|||||||
{
|
{
|
||||||
foreach ($alias->attributes as $name => $node) {
|
foreach ($alias->attributes as $name => $node) {
|
||||||
if (!in_array($name, array('alias', 'id', 'public'))) {
|
if (!in_array($name, array('alias', 'id', 'public'))) {
|
||||||
@trigger_error(sprintf('Using the attribute "%s" is deprecated for alias definition "%s" in "%s". Allowed attributes are "alias", "id" and "public". The XmlFileLoader will raise an exception in Symfony 4.0, instead of silently ignoring unsupported attributes.', $name, $alias->getAttribute('id'), $file), E_USER_DEPRECATED);
|
@trigger_error(sprintf('Using the attribute "%s" is deprecated for the service "%s" which is defined as an alias in "%s". Allowed attributes for service aliases are "alias", "id" and "public". The XmlFileLoader will raise an exception in Symfony 4.0, instead of silently ignoring unsupported attributes.', $name, $alias->getAttribute('id'), $file), E_USER_DEPRECATED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($alias->childNodes as $child) {
|
foreach ($alias->childNodes as $child) {
|
||||||
if ($child instanceof \DOMElement && $child->namespaceURI === self::NS) {
|
if ($child instanceof \DOMElement && $child->namespaceURI === self::NS) {
|
||||||
@trigger_error(sprintf('Using the element "%s" is deprecated for alias definition "%s" in "%s". The XmlFileLoader will raise an exception in Symfony 4.0, instead of silently ignoring unsupported elements.', $child->localName, $alias->getAttribute('id'), $file), E_USER_DEPRECATED);
|
@trigger_error(sprintf('Using the element "%s" is deprecated for the service "%s" which is defined as an alias in "%s". The XmlFileLoader will raise an exception in Symfony 4.0, instead of silently ignoring unsupported elements.', $child->localName, $alias->getAttribute('id'), $file), E_USER_DEPRECATED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -180,7 +180,7 @@ class YamlFileLoader extends FileLoader
|
|||||||
|
|
||||||
foreach ($service as $key => $value) {
|
foreach ($service as $key => $value) {
|
||||||
if (!in_array($key, array('alias', 'public'))) {
|
if (!in_array($key, array('alias', 'public'))) {
|
||||||
@trigger_error(sprintf('The configuration key "%s" is unsupported for alias definition "%s" in "%s". Allowed configuration keys are "alias" and "public". The YamlFileLoader will raise an exception in Symfony 4.0, instead of silently ignoring unsupported attributes.', $key, $id, $file), E_USER_DEPRECATED);
|
@trigger_error(sprintf('The configuration key "%s" is unsupported for the service "%s" which is defined as an alias in "%s". Allowed configuration keys for service aliases are "alias" and "public". The YamlFileLoader will raise an exception in Symfony 4.0, instead of silently ignoring unsupported attributes.', $key, $id, $file), E_USER_DEPRECATED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -563,9 +563,9 @@ class XmlFileLoaderTest extends \PHPUnit_Framework_TestCase
|
|||||||
public function testAliasDefinitionContainsUnsupportedElements()
|
public function testAliasDefinitionContainsUnsupportedElements()
|
||||||
{
|
{
|
||||||
$deprecations = array(
|
$deprecations = array(
|
||||||
'Using the attribute "class" is deprecated for alias definition "bar"',
|
'Using the attribute "class" is deprecated for the service "bar" which is defined as an alias',
|
||||||
'Using the element "tag" is deprecated for alias definition "bar"',
|
'Using the element "tag" is deprecated for the service "bar" which is defined as an alias',
|
||||||
'Using the element "factory" is deprecated for alias definition "bar"',
|
'Using the element "factory" is deprecated for the service "bar" which is defined as an alias',
|
||||||
);
|
);
|
||||||
|
|
||||||
ErrorAssert::assertDeprecationsAreTriggered($deprecations, function () {
|
ErrorAssert::assertDeprecationsAreTriggered($deprecations, function () {
|
||||||
|
Reference in New Issue
Block a user