-
-
Notifications
You must be signed in to change notification settings - Fork 122
/
Copy pathControllerResolver.php
37 lines (30 loc) · 1.03 KB
/
ControllerResolver.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Bundle\FrameworkBundle\Controller;
use Symfony\Component\HttpKernel\Controller\ContainerControllerResolver;
/**
* @author Fabien Potencier <[email protected]>
*
* @final
*/
class ControllerResolver extends ContainerControllerResolver
{
protected function instantiateController(string $class): object
{
$controller = parent::instantiateController($class);
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));
}
$controller->setContainer($previousContainer);
}
return $controller;
}
}