Skip to content

Commit f3eeb27

Browse files
Merge branch '6.1' into 6.2
* 6.1: [Messenger] cs fix [Messenger] Fix time-limit check exception [Console] Fix console `ProgressBar::override()` after manual `ProgressBar::cleanup()` [FrameworkBundle] typo default_lifetime example [HttpClient] Handle Amp HTTP client v5 incompatibility gracefully [HttpKernel] Don’t try to wire Response argument with controller.service_arguments [PhpUnitBridge] Fix language deprecations incorrectly marked as direct [FrameworkBundle] Removed unused $willBeAvailable params on Configuration [Cache] Remove extra type condition in MemcachedAdapter::createConnection() Tell about messenger:consume invalid limit options [Messenger] Do not throw 'no handlers' exception when skipping due to duplicate handling
2 parents 186b4d1 + ab9677e commit f3eeb27

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed

DependencyInjection/RegisterControllerArgumentLocatorsPass.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
use Symfony\Component\DependencyInjection\Reference;
2323
use Symfony\Component\DependencyInjection\TypedReference;
2424
use Symfony\Component\HttpFoundation\Request;
25+
use Symfony\Component\HttpFoundation\Response;
2526
use Symfony\Component\HttpFoundation\Session\SessionInterface;
2627
use Symfony\Component\VarExporter\ProxyHelper;
2728

@@ -151,7 +152,7 @@ public function process(ContainerBuilder $container)
151152
$invalidBehavior = ContainerInterface::RUNTIME_EXCEPTION_ON_INVALID_REFERENCE;
152153
}
153154

154-
if (Request::class === $type || SessionInterface::class === $type) {
155+
if (Request::class === $type || SessionInterface::class === $type || Response::class === $type) {
155156
continue;
156157
}
157158

Tests/DependencyInjection/RegisterControllerArgumentLocatorsPassTest.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
use Symfony\Component\DependencyInjection\Reference;
2525
use Symfony\Component\DependencyInjection\ServiceLocator;
2626
use Symfony\Component\DependencyInjection\TypedReference;
27+
use Symfony\Component\HttpFoundation\Response;
2728
use Symfony\Component\HttpKernel\DependencyInjection\RegisterControllerArgumentLocatorsPass;
2829
use Symfony\Component\HttpKernel\Tests\Fixtures\Suit;
2930

@@ -443,6 +444,20 @@ public function testBindWithTarget()
443444
$this->assertEquals($expected, $locator->getArgument(0));
444445
}
445446

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+
446461
public function testAutowireAttribute()
447462
{
448463
if (!class_exists(Autowire::class)) {
@@ -558,6 +573,13 @@ public function fooAction(
558573
}
559574
}
560575

576+
class WithResponseArgument
577+
{
578+
public function fooAction(Response $response, ?Response $nullableResponse)
579+
{
580+
}
581+
}
582+
561583
class WithAutowireAttribute
562584
{
563585
public function fooAction(

0 commit comments

Comments
 (0)