diff --git a/src/Symfony/Component/DependencyInjection/Compiler/ResolveNamedArgumentsPass.php b/src/Symfony/Component/DependencyInjection/Compiler/ResolveNamedArgumentsPass.php index 9f7b835100263..861e029ebfec0 100644 --- a/src/Symfony/Component/DependencyInjection/Compiler/ResolveNamedArgumentsPass.php +++ b/src/Symfony/Component/DependencyInjection/Compiler/ResolveNamedArgumentsPass.php @@ -40,7 +40,7 @@ protected function processValue($value, $isRoot = false) foreach ($arguments as $key => $argument) { if (is_int($key)) { - $resolvedArguments[] = $argument; + $resolvedArguments[$key] = $argument; continue; } if ('' === $key || '$' !== $key[0]) { diff --git a/src/Symfony/Component/DependencyInjection/Tests/Compiler/ResolveNamedArgumentsPassTest.php b/src/Symfony/Component/DependencyInjection/Tests/Compiler/ResolveNamedArgumentsPassTest.php index 8069840fe3626..8a214cd52da98 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Compiler/ResolveNamedArgumentsPassTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Compiler/ResolveNamedArgumentsPassTest.php @@ -27,13 +27,17 @@ public function testProcess() $container = new ContainerBuilder(); $definition = $container->register(NamedArgumentsDummy::class, NamedArgumentsDummy::class); - $definition->setArguments(array(0 => new Reference('foo'), '$apiKey' => '123')); + $definition->setArguments(array( + 2 => 'http://api.example.com', + '$apiKey' => '123', + 0 => new Reference('foo'), + )); $definition->addMethodCall('setApiKey', array('$apiKey' => '123')); $pass = new ResolveNamedArgumentsPass(); $pass->process($container); - $this->assertEquals(array(0 => new Reference('foo'), 1 => '123'), $definition->getArguments()); + $this->assertEquals(array(0 => new Reference('foo'), 1 => '123', 2 => 'http://api.example.com'), $definition->getArguments()); $this->assertEquals(array(array('setApiKey', array('123'))), $definition->getMethodCalls()); } diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/NamedArgumentsDummy.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/NamedArgumentsDummy.php index 05cfc1e945b97..65c4847bbdef5 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/NamedArgumentsDummy.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/NamedArgumentsDummy.php @@ -7,7 +7,7 @@ */ class NamedArgumentsDummy { - public function __construct(CaseSensitiveClass $c, $apiKey) + public function __construct(CaseSensitiveClass $c, $apiKey, $hostName) { } pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy