-
-
Notifications
You must be signed in to change notification settings - Fork 9.7k
Closed
Description
Symfony version(s) affected: 4.4
Description
The container lint command fails when using a combination of synthetic services & the expression language. I've created an example application to demonstrate the problem, all the code needed to reproduce the bug is in this commit: https://github.com/HypeMC/sf-container-lint-bug/commit/bb342d5b68892609fa86a048ce61f1750d0be6ab.
Basically the problem is that when using the service
function from the expression language with a service which it self requires a synthetic service, the lint command fails, even though the service definitions are valid. The following error message is outputed:
In ContainerBuilder.php line 1091:
You have requested a synthetic service ("kernel"). The DIC does not know how to construct this service.
How to reproduce
# config/services.yaml
App\Controller\TestController:
arguments:
- '@=service("App\\Service\\Test").getSomething()'
class TestController extends AbstractController
{
private $string;
public function __construct(string $string)
{
$this->string = $string;
}
/**
* @Route("/", name="test")
*/
public function index(): Response
{
return new Response($this->string);
}
}
class Test
{
private $kernel;
public function __construct(KernelInterface $kernel)
{
$this->kernel = $kernel;
}
public function getSomething(): string
{
return 'some-string';
}
}
spideyfusion, X-Coder264 and toniperic