Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 02b4aaa

Browse filesBrowse files
committed
[HttpKernel] Lazy load argument value resolvers
1 parent 03b7cf7 commit 02b4aaa
Copy full SHA for 02b4aaa

File tree

4 files changed

+7
-6
lines changed
Filter options

4 files changed

+7
-6
lines changed

‎src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/ControllerArgumentValueResolverPass.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/ControllerArgumentValueResolverPass.php
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
namespace Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler;
1313

14+
use Symfony\Component\DependencyInjection\Argument\IteratorArgument;
1415
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
1516
use Symfony\Component\DependencyInjection\Compiler\PriorityTaggedServiceTrait;
1617
use Symfony\Component\DependencyInjection\ContainerBuilder;
@@ -32,6 +33,6 @@ public function process(ContainerBuilder $container)
3233

3334
$definition = $container->getDefinition('argument_resolver');
3435
$argumentResolvers = $this->findAndSortTaggedServices('controller.argument_value_resolver', $container);
35-
$definition->replaceArgument(1, $argumentResolvers);
36+
$definition->replaceArgument(1, new IteratorArgument($argumentResolvers));
3637
}
3738
}

‎src/Symfony/Bundle/FrameworkBundle/Resources/config/web.xml

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Resources/config/web.xml
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
<service id="argument_resolver" class="Symfony\Component\HttpKernel\Controller\ArgumentResolver" public="false">
2323
<argument type="service" id="argument_metadata_factory" />
24-
<argument type="collection" />
24+
<argument /> <!-- argument value resolvers -->
2525
</service>
2626

2727
<service id="argument_resolver.request_attribute" class="Symfony\Component\HttpKernel\Controller\ArgumentResolver\RequestAttributeValueResolver" public="false">

‎src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/ControllerArgumentValueResolverPassTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/ControllerArgumentValueResolverPassTest.php
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public function testServicesAreOrderedAccordingToPriority()
4242
}
4343

4444
(new ControllerArgumentValueResolverPass())->process($container);
45-
$this->assertEquals($expected, $definition->getArgument(1));
45+
$this->assertEquals($expected, $definition->getArgument(1)->getValues());
4646
}
4747

4848
public function testReturningEmptyArrayWhenNoService()
@@ -52,7 +52,7 @@ public function testReturningEmptyArrayWhenNoService()
5252
$container->setDefinition('argument_resolver', $definition);
5353

5454
(new ControllerArgumentValueResolverPass())->process($container);
55-
$this->assertEquals(array(), $definition->getArgument(1));
55+
$this->assertEquals(array(), $definition->getArgument(1)->getValues());
5656
}
5757

5858
public function testNoArgumentResolver()

‎src/Symfony/Component/HttpKernel/Controller/ArgumentResolver.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/HttpKernel/Controller/ArgumentResolver.php
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,11 @@ final class ArgumentResolver implements ArgumentResolverInterface
2929
private $argumentMetadataFactory;
3030

3131
/**
32-
* @var ArgumentValueResolverInterface[]
32+
* @var iterable|ArgumentValueResolverInterface[]
3333
*/
3434
private $argumentValueResolvers;
3535

36-
public function __construct(ArgumentMetadataFactoryInterface $argumentMetadataFactory = null, array $argumentValueResolvers = array())
36+
public function __construct(ArgumentMetadataFactoryInterface $argumentMetadataFactory = null, $argumentValueResolvers = array())
3737
{
3838
$this->argumentMetadataFactory = $argumentMetadataFactory ?: new ArgumentMetadataFactory();
3939
$this->argumentValueResolvers = $argumentValueResolvers ?: self::getDefaultArgumentValueResolvers();

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.