Mercurial > hg > isophonics-drupal-site
diff vendor/symfony/dependency-injection/Dumper/YamlDumper.php @ 17:129ea1e6d783
Update, including to Drupal core 8.6.10
author | Chris Cannam |
---|---|
date | Thu, 28 Feb 2019 13:21:36 +0000 |
parents | 1fec387a4317 |
children |
line wrap: on
line diff
--- a/vendor/symfony/dependency-injection/Dumper/YamlDumper.php Tue Jul 10 15:07:59 2018 +0100 +++ b/vendor/symfony/dependency-injection/Dumper/YamlDumper.php Thu Feb 28 13:21:36 2019 +0000 @@ -11,10 +11,6 @@ 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; @@ -22,10 +18,14 @@ 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. @@ -41,7 +41,7 @@ * * @return string A YAML string representing of the service container */ - public function dump(array $options = array()) + public function dump(array $options = []) { if (!class_exists('Symfony\Component\Yaml\Dumper')) { throw new RuntimeException('Unable to dump the container as the Symfony Yaml Component is not installed.'); @@ -80,7 +80,7 @@ $tagsCode = ''; foreach ($definition->getTags() as $name => $tags) { foreach ($tags as $attributes) { - $att = array(); + $att = []; foreach ($attributes as $key => $value) { $att[] = sprintf('%s: %s', $this->dumper->dump($key), $this->dumper->dump($value)); } @@ -102,7 +102,7 @@ } 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()) { @@ -224,7 +224,7 @@ $parameters = $this->prepareParameters($this->container->getParameterBag()->all(), $this->container->isCompiled()); - return $this->dumper->dump(array('parameters' => $parameters), 2); + return $this->dumper->dump(['parameters' => $parameters], 2); } /** @@ -236,11 +236,11 @@ */ 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]); + $callable = [$this->getServiceCall((string) $callable[0], $callable[0]), $callable[1]]; } else { - $callable = array($callable[0], $callable[1]); + $callable = [$callable[0], $callable[1]]; } } @@ -268,14 +268,14 @@ 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)) { - $code = array(); + if (\is_array($value)) { + $code = []; foreach ($value as $k => $v) { $code[$k] = $this->dumpValue($v); } @@ -289,7 +289,7 @@ 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.'); } @@ -344,11 +344,11 @@ */ private function prepareParameters(array $parameters, $escape = true) { - $filtered = array(); + $filtered = []; 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; } @@ -365,11 +365,11 @@ */ private function escape(array $arguments) { - $args = array(); + $args = []; 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;