diff --git a/core/lib/Drupal/Core/DependencyInjection/Dumper/PhpArrayDumper.php b/core/lib/Drupal/Core/DependencyInjection/Dumper/PhpArrayDumper.php index 498803c..eb084d2 100644 --- a/core/lib/Drupal/Core/DependencyInjection/Dumper/PhpArrayDumper.php +++ b/core/lib/Drupal/Core/DependencyInjection/Dumper/PhpArrayDumper.php @@ -188,26 +188,10 @@ protected function getServiceDefinition($definition) $service['synthetic'] = TRUE; } - if ($definition->isSynchronized()) { - $service['synchronized'] = TRUE; - } - - if ($definition->getFactoryClass()) { - $service['factory_class'] = $definition->getFactoryClass(); - } - if ($definition->isLazy()) { $service['lazy'] = TRUE; } - if ($definition->getFactoryMethod()) { - $service['factory_method'] = $definition->getFactoryMethod(); - } - - if ($definition->getFactoryService()) { - $service['factory_service'] = $definition->getFactoryService(); - } - if ($definition->getArguments()) { $service['arguments'] = $this->dumpValue($definition->getArguments()); } @@ -272,7 +256,16 @@ protected function dumpCallable($callable) if (is_array($callable)) { if ($callable[0] instanceof Reference) { $callable = array($this->getServiceCall((string) $callable[0], $callable[0]), $callable[1]); - } else { + } + elseif ($callable[0] instanceof Definition) { + $service = $this->getServiceDefinition($callable[0]); + $callable[0] = (object) [ + 'type' => 'service', + 'value' => $service, + ]; + $callable = array($callable[0], $callable[1]); + } + else { $callable = array($callable[0], $callable[1]); } } diff --git a/core/lib/Drupal/Core/DependencyInjection/PhpArray/Container.php b/core/lib/Drupal/Core/DependencyInjection/PhpArray/Container.php index a2de011..9b692c1 100644 --- a/core/lib/Drupal/Core/DependencyInjection/PhpArray/Container.php +++ b/core/lib/Drupal/Core/DependencyInjection/PhpArray/Container.php @@ -107,6 +107,7 @@ public function get($name, $invalidBehavior = ContainerInterface::EXCEPTION_ON_I $definition += array( 'class' => '', + 'factory' => '', 'factory_class' => '', 'factory_method' => '', 'factory_service' => '', @@ -120,8 +121,8 @@ public function get($name, $invalidBehavior = ContainerInterface::EXCEPTION_ON_I $arguments = $this->expandArguments($definition['arguments'], $invalidBehavior); if (!empty($definition['factory'])) { $factory = $definition['factory']; - if (is_array($factory) && strpos($factory[0], '@') === 0) { - $factory[0] = $this->get(substr($factory[0], 1), $invalidBehavior); + if (is_array($factory)) { + $factory = $this->expandArguments($factory, $invalidBehavior); } $service = call_user_func_array($factory, $arguments); }