function XmlDumper::phpToXml
Converts php types to xml types.
Throws
RuntimeException When trying to dump object or resource
1 call to XmlDumper::phpToXml()
- XmlDumper::convertParameters in vendor/
symfony/ dependency-injection/ Dumper/ XmlDumper.php
File
-
vendor/
symfony/ dependency-injection/ Dumper/ XmlDumper.php, line 413
Class
- XmlDumper
- XmlDumper dumps a service container as an XML string.
Namespace
Symfony\Component\DependencyInjection\DumperCode
public static function phpToXml(mixed $value) : string {
switch (true) {
case null === $value:
return 'null';
case true === $value:
return 'true';
case false === $value:
return 'false';
case $value instanceof Parameter:
return '%' . $value . '%';
case $value instanceof \UnitEnum:
return \sprintf('%s::%s', $value::class, $value->name);
case \is_object($value) || \is_resource($value):
throw new RuntimeException(\sprintf('Unable to dump a service container if a parameter is an object or a resource, got "%s".', get_debug_type($value)));
default:
return (string) $value;
}
}