[DependencyInjection] Deprecate SimpleXMLElement

This commit is contained in:
Romain Neutron 2014-04-02 17:31:05 +02:00
parent 33c91f9be8
commit a3c60c8039
3 changed files with 8 additions and 22 deletions

View File

@ -5,6 +5,7 @@ CHANGELOG
-----
* added DecoratorServicePass and a way to override a service definition (Definition::setDecoratedService())
* deprecated SimpleXMLElement class.
2.4.0
-----

View File

@ -197,37 +197,20 @@ class XmlFileLoader extends FileLoader
$parameters[$normalizedName] = XmlUtils::phpize($node->nodeValue);
}
// keep not normalized key for BC too
$parameters[$name] = SimpleXMLElement::phpize($value);
$parameters[$name] = XmlUtils::phpize($node->nodeValue);
}
// $definition->addTag((string) $tag['name'], $parameters);
$definition->addTag($tag->getAttribute('name'), $parameters);
}
if (isset($service['decorates'])) {
$renameId = isset($service['decoration-inner-name']) ? (string) $service['decoration-inner-name'] : null;
$definition->setDecoratedService((string) $service['decorates'], $renameId);
if ($value = $service->getAttribute('decorates')) {
$renameId = $service->hasAttribute('decoration-inner-name') ? $service->getAttribute('decoration-inner-name') : null;
$definition->setDecoratedService($value, $renameId);
}
$this->container->setDefinition($id, $definition);
}
/**
* Parses a XML file.
*
* @param string $file Path to a file
*
* @return SimpleXMLElement
*
* @throws InvalidArgumentException When loading of XML file returns error
*/
protected function parseFile($file)
{
$dom = $this->parseFileToDOM($file);
return simplexml_import_dom($dom, 'Symfony\\Component\\DependencyInjection\\SimpleXMLElement');
}
/**
* Parses a XML file to a \DOMDocument
*
@ -237,7 +220,7 @@ class XmlFileLoader extends FileLoader
*
* @throws InvalidArgumentException When loading of XML file returns error
*/
protected function parseFileToDOM($file)
private function parseFileToDOM($file)
{
try {
$dom = XmlUtils::loadFile($file, array($this, 'validateSchema'));

View File

@ -18,6 +18,8 @@ use Symfony\Component\ExpressionLanguage\Expression;
* SimpleXMLElement class.
*
* @author Fabien Potencier <fabien@symfony.com>
*
* @deprecated Deprecated since version 2.5, to be removed in 3.0.
*/
class SimpleXMLElement extends \SimpleXMLElement
{