|
24 | 24 | use Symfony\Component\DependencyInjection\Reference;
|
25 | 25 | use Symfony\Component\DependencyInjection\ServiceLocator;
|
26 | 26 | use Symfony\Component\DependencyInjection\TypedReference;
|
| 27 | +use Symfony\Component\HttpFoundation\Response; |
27 | 28 | use Symfony\Component\HttpKernel\DependencyInjection\RegisterControllerArgumentLocatorsPass;
|
28 | 29 | use Symfony\Component\HttpKernel\Tests\Fixtures\Suit;
|
29 | 30 |
|
@@ -443,6 +444,20 @@ public function testBindWithTarget()
|
443 | 444 | $this->assertEquals($expected, $locator->getArgument(0));
|
444 | 445 | }
|
445 | 446 |
|
| 447 | + public function testResponseArgumentIsIgnored() |
| 448 | + { |
| 449 | + $container = new ContainerBuilder(); |
| 450 | + $resolver = $container->register('argument_resolver.service', 'stdClass')->addArgument([]); |
| 451 | + |
| 452 | + $container->register('foo', WithResponseArgument::class) |
| 453 | + ->addTag('controller.service_arguments'); |
| 454 | + |
| 455 | + (new RegisterControllerArgumentLocatorsPass())->process($container); |
| 456 | + |
| 457 | + $locator = $container->getDefinition((string) $resolver->getArgument(0))->getArgument(0); |
| 458 | + $this->assertEmpty(array_keys($locator), 'Response typed argument is ignored'); |
| 459 | + } |
| 460 | + |
446 | 461 | public function testAutowireAttribute()
|
447 | 462 | {
|
448 | 463 | if (!class_exists(Autowire::class)) {
|
@@ -558,6 +573,13 @@ public function fooAction(
|
558 | 573 | }
|
559 | 574 | }
|
560 | 575 |
|
| 576 | +class WithResponseArgument |
| 577 | +{ |
| 578 | + public function fooAction(Response $response, ?Response $nullableResponse) |
| 579 | + { |
| 580 | + } |
| 581 | +} |
| 582 | + |
561 | 583 | class WithAutowireAttribute
|
562 | 584 | {
|
563 | 585 | public function fooAction(
|
|
0 commit comments