use Symfony\Component\HttpKernel\Controller\ContainerControllerResolver;
/**
* @author Fabien Potencier <fabien@symfony.com>
*
* @final
*/
class ControllerResolver extends ContainerControllerResolver
{ protected function instantiateController(string
$class): object
{ $controller = parent::
instantiateController($class);
if ($controller instanceof ContainerAwareInterface
) { trigger_deprecation('symfony/dependency-injection', '6.4', 'Relying on "%s" to get the container in "%s" is deprecated, register the controller as a service and use dependency injection instead.', ContainerAwareInterface::
class,
get_debug_type($controller));
$controller->
setContainer($this->container
);
} if ($controller instanceof AbstractController
) { if (null ===
$previousContainer =
$controller->
setContainer($this->container
)) { throw new \
LogicException(sprintf('"%s" has no container set, did you forget to define it as a service subscriber?',
$class));
} else { $controller->
setContainer($previousContainer);
} }