minor #14665 [HttpKernel] trigger a deprecation warning when using the ContainerAwareHttpKernel (xabbuh)
This PR was merged into the 2.7 branch.
Discussion
----------
[HttpKernel] trigger a deprecation warning when using the ContainerAwareHttpKernel
| Q | A
| ------------- | ---
| Bug fix? | no
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #13280
| License | MIT
| Doc PR |
I agree that we should not trigger the deprecation warning when the `ContainerAwareHttpKernel` is used in the framework code. However, developers using this class in their own code should receive a warning to be able to prepare their applications for Symfony 3.0.
Commits
-------
030731a
[HttpKernel] trigger a deprecation warning when using the ContainerAwareHttpKernel
This commit is contained in:
commit
8bfe846ee4
@ -25,6 +25,7 @@
|
||||
<argument type="service" id="service_container" />
|
||||
<argument type="service" id="controller_resolver" />
|
||||
<argument type="service" id="request_stack" />
|
||||
<argument>false</argument>
|
||||
</service>
|
||||
|
||||
<service id="request_stack" class="%request_stack.class%" />
|
||||
|
@ -39,11 +39,16 @@ class ContainerAwareHttpKernel extends HttpKernel
|
||||
* @param ContainerInterface $container A ContainerInterface instance
|
||||
* @param ControllerResolverInterface $controllerResolver A ControllerResolverInterface instance
|
||||
* @param RequestStack $requestStack A stack for master/sub requests
|
||||
* @param bool $triggerDeprecation Whether or not to trigger the deprecation warning for the ContainerAwareHttpKernel
|
||||
*/
|
||||
public function __construct(EventDispatcherInterface $dispatcher, ContainerInterface $container, ControllerResolverInterface $controllerResolver, RequestStack $requestStack = null)
|
||||
public function __construct(EventDispatcherInterface $dispatcher, ContainerInterface $container, ControllerResolverInterface $controllerResolver, RequestStack $requestStack = null, $triggerDeprecation = true)
|
||||
{
|
||||
parent::__construct($dispatcher, $controllerResolver, $requestStack);
|
||||
|
||||
if ($triggerDeprecation) {
|
||||
trigger_error('The '.__CLASS__.' class is deprecated since version 2.7 and will be removed in 3.0. Use the Symfony\Component\HttpKernel\HttpKernel class instead.', E_USER_DEPRECATED);
|
||||
}
|
||||
|
||||
$this->container = $container;
|
||||
|
||||
// the request scope might have been created before (see FrameworkBundle)
|
||||
|
@ -18,6 +18,9 @@ use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\EventDispatcher\EventDispatcher;
|
||||
|
||||
/**
|
||||
* @group legacy
|
||||
*/
|
||||
class ContainerAwareHttpKernelTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
|
Reference in New Issue
Block a user