Closed
Description
Q | A |
---|---|
Bug report? | yes |
Feature request? | no |
BC Break report? | no |
RFC? | no |
Symfony version | 3.4 (maybe earlier) |
With default routing and services configuration create a simple controller with a non-service class like this:
<?php
namespace App\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;
class IndexController extends AbstractController
{
/**
* @Route(name="index")
*/
public function indexAction(A $a)
{
dump($a);
return new Response();
}
}
class A
{
}
Expected result: an exception about wrong argument. Actual result:
Which means that a new instance of a non-DI class is injected.
I investigated a little and found that Symfony\Component\HttpKernel\Controller\ArgumentResolver\ServiceValueResolver
does this.