From 81ae6351009a9a2562bc123e4a0abfcf34c29a44 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Mon, 30 Sep 2019 15:58:09 +0200 Subject: [PATCH] drop support for retrieving container from non-booted kernels --- src/Symfony/Component/HttpKernel/CHANGELOG.md | 1 + src/Symfony/Component/HttpKernel/Kernel.php | 2 +- .../Component/HttpKernel/Tests/KernelTest.php | 24 ------------------- 3 files changed, 2 insertions(+), 25 deletions(-) diff --git a/src/Symfony/Component/HttpKernel/CHANGELOG.md b/src/Symfony/Component/HttpKernel/CHANGELOG.md index 0d365db160..5be8195dc4 100644 --- a/src/Symfony/Component/HttpKernel/CHANGELOG.md +++ b/src/Symfony/Component/HttpKernel/CHANGELOG.md @@ -4,6 +4,7 @@ CHANGELOG 5.0.0 ----- + * removed support for getting the container from a non-booted kernel * removed the first and second constructor argument of `ConfigDataCollector` * removed `ConfigDataCollector::getApplicationName()` * removed `ConfigDataCollector::getApplicationVersion()` diff --git a/src/Symfony/Component/HttpKernel/Kernel.php b/src/Symfony/Component/HttpKernel/Kernel.php index fe40641bd1..791f0a2a2e 100644 --- a/src/Symfony/Component/HttpKernel/Kernel.php +++ b/src/Symfony/Component/HttpKernel/Kernel.php @@ -301,7 +301,7 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl public function getContainer() { if (!$this->booted) { - @trigger_error('Getting the container from a non-booted kernel is deprecated since Symfony 4.4.', E_USER_DEPRECATED); + throw new \LogicException('Cannot retrieve the container from a non-booted kernel.'); } return $this->container; diff --git a/src/Symfony/Component/HttpKernel/Tests/KernelTest.php b/src/Symfony/Component/HttpKernel/Tests/KernelTest.php index 44f280b180..e185c6f862 100644 --- a/src/Symfony/Component/HttpKernel/Tests/KernelTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/KernelTest.php @@ -47,18 +47,6 @@ class KernelTest extends TestCase $this->assertLessThanOrEqual(microtime(true), $kernel->getStartTime()); } - /** - * @group legacy - * @expectedDeprecation Getting the container from a non-booted kernel is deprecated since Symfony 4.4. - */ - public function testGetContainerForANonBootedKernel() - { - $kernel = new KernelForTest('test_env', true); - - $this->assertFalse($kernel->isBooted()); - $this->assertNull($kernel->getContainer()); - } - public function testClone() { $env = 'test_env'; @@ -407,18 +395,6 @@ EOF; $kernel->terminate(Request::create('/'), new Response()); } - /** - * @group legacy - * @expectedDeprecation Getting the container from a non-booted kernel is deprecated since Symfony 4.4. - */ - public function testDeprecatedNullKernel() - { - $kernel = $this->getKernel(); - $kernel->shutdown(); - - $this->assertNull($kernel->getContainer()); - } - public function testTerminateDelegatesTerminationOnlyForTerminableInterface() { // does not implement TerminableInterface