8000 [HttpKernel] "controller.service_arguments" services should be public · symfony/symfony@b9c6928 · GitHub
[go: up one dir, main page]

Skip to content

Commit b9c6928

Browse files
[HttpKernel] "controller.service_arguments" services should be public
1 parent 5f5ed69 commit b9c6928

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

src/Symfony/Component/HttpKernel/DependencyInjection/RegisterControllerArgumentLocatorsPass.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ public function process(ContainerBuilder $container)
5050

5151
foreach ($container->findTaggedServiceIds($this->controllerTag, true) as $id => $tags) {
5252
$def = $container->getDefinition($id);
53+
$def->setPublic(true);
5354
$class = $def->getClass();
5455
$autowire = $def->isAutowired();
5556

src/Symfony/Component/HttpKernel/Tests/DependencyInjection/RegisterControllerArgumentLocatorsPassTest.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,21 @@ public function testArgumentWithNoTypeHintIsOk()
266266
$locator = $container->getDefinition((string) $resolver->getArgument(0))->getArgument(0);
267267
$this->assertEmpty(array_keys($locator) 8000 );
268268
}
269+
270+
public function testControllersAreMadePublic()
271+
{
272+
$container = new ContainerBuilder();
273+
$resolver = $container->register('argument_resolver.service')->addArgument(array());
274+
275+
$container->register('foo', ArgumentWithoutTypeController::class)
276+
->setPublic(false)
277+
->addTag('controller.service_arguments');
278+
279+
$pass = new RegisterControllerArgumentLocatorsPass();
280+
$pass->process($container);
281+
282+
$this->assertTrue($container->getDefinition('foo')->isPublic());
283+
}
269284
}
270285

271286
class RegisterTestController

0 commit comments

Comments
 (0)
0