|
23 | 23 | use Symfony\Component\DependencyInjection\Reference;
|
24 | 24 | use Symfony\Component\DependencyInjection\ServiceLocator;
|
25 | 25 | use Symfony\Component\DependencyInjection\TypedReference;
|
| 26 | +use Symfony\Component\HttpFoundation\Response; |
26 | 27 | use Symfony\Component\HttpKernel\DependencyInjection\RegisterControllerArgumentLocatorsPass;
|
27 | 28 | use Symfony\Component\HttpKernel\Tests\Fixtures\Suit;
|
28 | 29 |
|
@@ -444,6 +445,20 @@ public function testBindWithTarget()
|
444 | 445 | ];
|
445 | 446 | $this->assertEquals($expected, $locator->getArgument(0));
|
446 | 447 | }
|
| 448 | + |
| 449 | + public function testResponseArgumentIsIgnored() |
| 450 | + { |
| 451 | + $container = new ContainerBuilder(); |
| 452 | + $resolver = $container->register('argument_resolver.service', 'stdClass')->addArgument([]); |
| 453 | + |
| 454 | + $container->register('foo', WithResponseArgument::class) |
| 455 | + ->addTag('controller.service_arguments'); |
| 456 | + |
| 457 | + (new RegisterControllerArgumentLocatorsPass())->process($container); |
| 458 | + |
| 459 | + $locator = $container->getDefinition((string) $resolver->getArgument(0))->getArgument(0); |
| 460 | + $this->assertEmpty(array_keys($locator), 'Response typed argument is ignored'); |
| 461 | + } |
447 | 462 | }
|
448 | 463 |
|
449 | 464 | class RegisterTestController
|
@@ -524,3 +539,10 @@ public function fooAction(
|
524 | 539 | ) {
|
525 | 540 | }
|
526 | 541 | }
|
| 542 | + |
| 543 | +class WithResponseArgument |
| 544 | +{ |
| 545 | + public function fooAction(Response $response, ?Response $nullableResponse) |
| 546 | + { |
| 547 | + } |
| 548 | +} |
0 commit comments