namespace Symfony\Component\DependencyInjection\Dumper;
-use Symfony\Component\Yaml\Dumper as YmlDumper;
-use Symfony\Component\Yaml\Parser;
-use Symfony\Component\Yaml\Tag\TaggedValue;
-use Symfony\Component\Yaml\Yaml;
use Symfony\Component\DependencyInjection\Alias;
use Symfony\Component\DependencyInjection\Argument\ArgumentInterface;
use Symfony\Component\DependencyInjection\Argument\IteratorArgument;
use Symfony\Component\DependencyInjection\Argument\TaggedIteratorArgument;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\DependencyInjection\Definition;
+use Symfony\Component\DependencyInjection\Exception\RuntimeException;
use Symfony\Component\DependencyInjection\Parameter;
use Symfony\Component\DependencyInjection\Reference;
-use Symfony\Component\DependencyInjection\Exception\RuntimeException;
use Symfony\Component\ExpressionLanguage\Expression;
+use Symfony\Component\Yaml\Dumper as YmlDumper;
+use Symfony\Component\Yaml\Parser;
+use Symfony\Component\Yaml\Tag\TaggedValue;
+use Symfony\Component\Yaml\Yaml;
/**
* YamlDumper dumps a service container as a YAML string.
}
if ($definition->isDeprecated()) {
- $code .= sprintf(" deprecated: %s\n", $definition->getDeprecationMessage('%service_id%'));
+ $code .= sprintf(" deprecated: %s\n", $this->dumper->dump($definition->getDeprecationMessage('%service_id%')));
}
if ($definition->isAutowired()) {
*/
private function dumpCallable($callable)
{
- if (is_array($callable)) {
+ if (\is_array($callable)) {
if ($callable[0] instanceof Reference) {
$callable = array($this->getServiceCall((string) $callable[0], $callable[0]), $callable[1]);
} else {
if ($value instanceof IteratorArgument) {
$tag = 'iterator';
} else {
- throw new RuntimeException(sprintf('Unspecified Yaml tag for type "%s".', get_class($value)));
+ throw new RuntimeException(sprintf('Unspecified Yaml tag for type "%s".', \get_class($value)));
}
return new TaggedValue($tag, $this->dumpValue($value->getValues()));
}
- if (is_array($value)) {
+ if (\is_array($value)) {
$code = array();
foreach ($value as $k => $v) {
$code[$k] = $this->dumpValue($v);
return $this->getExpressionCall((string) $value);
} elseif ($value instanceof Definition) {
return new TaggedValue('service', (new Parser())->parse("_:\n".$this->addService('_', $value), Yaml::PARSE_CUSTOM_TAGS)['_']['_']);
- } elseif (is_object($value) || is_resource($value)) {
+ } elseif (\is_object($value) || \is_resource($value)) {
throw new RuntimeException('Unable to dump a service container if a parameter is an object or a resource.');
}
{
$filtered = array();
foreach ($parameters as $key => $value) {
- if (is_array($value)) {
+ if (\is_array($value)) {
$value = $this->prepareParameters($value, $escape);
- } elseif ($value instanceof Reference || is_string($value) && 0 === strpos($value, '@')) {
+ } elseif ($value instanceof Reference || \is_string($value) && 0 === strpos($value, '@')) {
$value = '@'.$value;
}
{
$args = array();
foreach ($arguments as $k => $v) {
- if (is_array($v)) {
+ if (\is_array($v)) {
$args[$k] = $this->escape($v);
- } elseif (is_string($v)) {
+ } elseif (\is_string($v)) {
$args[$k] = str_replace('%', '%%', $v);
} else {
$args[$k] = $v;