Skip to content

Commit a564504

Browse files
Merge branch '5.4' into 6.0
* 5.4: [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 Tell about messenger:consume invalid limit options [Messenger] Do not throw 'no handlers' exception when skipping due to duplicate handling
2 parents e71b52c + 5417392 commit a564504

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
@@ -24,6 +24,7 @@
2424
use Symfony\Component\DependencyInjection\Reference;
2525
use Symfony\Component\DependencyInjection\TypedReference;
2626
use Symfony\Component\HttpFoundation\Request;
27+
use Symfony\Component\HttpFoundation\Response;
2728
use Symfony\Component\HttpFoundation\Session\SessionInterface;
2829

2930
/**
@@ -157,7 +158,7 @@ public function process(ContainerBuilder $container)
157158
$invalidBehavior = ContainerInterface::RUNTIME_EXCEPTION_ON_INVALID_REFERENCE;
158159
}
159160

160-
if (Request::class === $type || SessionInterface::class === $type) {
161+
if (Request::class === $type || SessionInterface::class === $type || Response::class === $type) {
161162
continue;
162163
}
163164

Tests/DependencyInjection/RegisterControllerArgumentLocatorsPassTest.php

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

@@ -444,6 +445,20 @@ public function testBindWithTarget()
444445
];
445446
$this->assertEquals($expected, $locator->getArgument(0));
446447
}
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+
}
447462
}
448463

449464
class RegisterTestController
@@ -524,3 +539,10 @@ public function fooAction(
524539
) {
525540
}
526541
}
542+
543+
class WithResponseArgument
544+
{
545+
public function fooAction(Response $response, ?Response $nullableResponse)
546+
{
547+
}
548+
}

0 commit comments

Comments
 (0)