8000 minor #14665 [HttpKernel] trigger a deprecation warning when using th… · symfony/symfony@8bfe846 · GitHub
[go: up one dir, main page]

Skip to content

Commit 8bfe846

Browse files
committed
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
2 parents aca6ff6 + 030731a commit 8bfe846

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

src/Symfony/Bundle/FrameworkBundle/Resources/config/services.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
<argument type="service" id="service_container" />
2626
<argument type="service" id="controller_resolver" />
2727
<argument type="service" id="request_stack" />
28+
<argument>false</argument>
2829
</service>
2930

3031
<service id="request_stack" class="%request_stack.class%" />

src/Symfony/Component/HttpKernel/DependencyInjection/ContainerAwareHttpKernel.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,16 @@ class ContainerAwareHttpKernel extends HttpKernel
3939
* @param ContainerInterface $container A ContainerInterface instance
4040
* @param ControllerResolverInterface $controllerResolver A ControllerResolverInterface instance
4141
* @param RequestStack $requestStack A stack for master/sub requests
42+
* @param bool $triggerDeprecation Whether or not to trigger the deprecation warning for the ContainerAwareHttpKernel
4243
*/
43-
public function __construct(EventDispatcherInterface $dispatcher, ContainerInterface $container, ControllerResolverInterface $controllerResolver, RequestStack $requestStack = null)
44+
public function __construct(EventDispatcherInterface $dispatcher, ContainerInterface $container, ControllerResolverInterface $controllerResolver, RequestStack $requestStack = null, $triggerDeprecation = true)
4445
{
4546
parent::__construct($dispatcher, $controllerResolver, $requestStack);
4647

48+
if ($triggerDeprecation) {
49+
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);
50+
}
51+
4752
$this->container = $container;
4853

4954
// the request scope might have been created before (see FrameworkBundle)

src/Symfony/Component/HttpKernel/Tests/DependencyInjection/ContainerAwareHttpKernelTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@
1818
use Symfony\Component\HttpFoundation\Request;
1919
use Symfony\Component\EventDispatcher\EventDispatcher;
2020

21+
/**
22+
* @group legacy
23+
*/
2124
class ContainerAwareHttpKernelTest extends \PHPUnit_Framework_TestCase
2225
{
2326
/**

0 commit comments

Comments
 (0)
0