Skip to content

Commit fa4fe3d

Browse files
committed
Move ControllerArgumentValueResolverPass to the HttpKernel component
1 parent ec5ca9c commit fa4fe3d

File tree

4 files changed

+12
-18
lines changed

4 files changed

+12
-18
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ CHANGELOG
2727
`render()`, `renderView()` and `stream()` methods can only use Twig (using the Templating component is not supported).
2828
The `json()` method requires the Serializer component (use `Symfony\Component\HttpFoundation\JsonResponse` directly if
2929
you do not want to use the Serializer).
30+
* Deprecated `ControllerArgumentValueResolverPass`. Use
31+
`Symfony\Component\HttpKernel\DependencyInjection\ControllerArgumentValueResolverPass` instead
3032

3133
3.2.0
3234
-----

DependencyInjection/Compiler/ControllerArgumentValueResolverPass.php

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -11,28 +11,17 @@
1111

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

14-
use Symfony\Component\DependencyInjection\Argument\IteratorArgument;
15-
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
16-
use Symfony\Component\DependencyInjection\Compiler\PriorityTaggedServiceTrait;
17-
use Symfony\Component\DependencyInjection\ContainerBuilder;
14+
use Symfony\Component\HttpKernel\DependencyInjection\ControllerArgumentValueResolverPass as BaseControllerArgumentValueResolverPass;
15+
16+
@trigger_error(sprintf('The %s class is deprecated since version 3.3 and will be removed in 4.0. Use %s instead.', ControllerArgumentValueResolverPass::class, BaseControllerArgumentValueResolverPass::class), E_USER_DEPRECATED);
1817

1918
/**
2019
* Gathers and configures the argument value resolvers.
2120
*
2221
* @author Iltar van der Berg <kjarli@gmail.com>
22+
*
23+
* @deprecated since version 3.3, to be removed in 4.0. Use {@link BaseControllerArgumentValueResolverPass}
2324
*/
24-
class ControllerArgumentValueResolverPass implements CompilerPassInterface
25+
class ControllerArgumentValueResolverPass extends BaseControllerArgumentValueResolverPass
2526
{
26-
use PriorityTaggedServiceTrait;
27-
28-
public function process(ContainerBuilder $container)
29-
{
30-
if (!$container->hasDefinition('argument_resolver')) {
31-
return;
32-
}
33-
34-
$definition = $container->getDefinition('argument_resolver');
35-
$argumentResolvers = $this->findAndSortTaggedServices('controller.argument_value_resolver', $container);
36-
$definition->replaceArgument(1, new IteratorArgument($argumentResolvers));
37-
}
3827
}

FrameworkBundle.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\CacheCollectorPass;
1919
use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\CachePoolPass;
2020
use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\CachePoolClearerPass;
21-
use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\ControllerArgumentValueResolverPass;
2221
use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\DataCollectorTranslatorPass;
2322
use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\TemplatingPass;
2423
use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\RoutingResolverPass;
@@ -36,6 +35,7 @@
3635
use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\ValidateWorkflowsPass;
3736
use Symfony\Component\Config\DependencyInjection\ConfigCachePass;
3837
use Symfony\Component\Console\DependencyInjection\AddConsoleCommandPass;
38+
use Symfony\Component\HttpKernel\DependencyInjection\ControllerArgumentValueResolverPass;
3939
use Symfony\Component\PropertyInfo\DependencyInjection\PropertyInfoPass;
4040
use Symfony\Component\Serializer\DependencyInjection\SerializerPass;
4141
use Symfony\Component\Debug\ErrorHandler;

Tests/DependencyInjection/Compiler/ControllerArgumentValueResolverPassTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@
1818
use Symfony\Component\DependencyInjection\Reference;
1919
use Symfony\Component\HttpKernel\Controller\ArgumentResolver;
2020

21+
/**
22+
* @group legacy
23+
*/
2124
class ControllerArgumentValueResolverPassTest extends TestCase
2225
{
2326
public function testServicesAreOrderedAccordingToPriority()

0 commit comments

Comments
 (0)