Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 5e48c39

Browse files
committed
minor #33760 [HttpKernel] drop support for retrieving container from non-booted kernels (xabbuh)
This PR was merged into the 5.0-dev branch. Discussion ---------- [HttpKernel] drop support for retrieving container from non-booted kernels | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | no | Deprecations? | no | Tickets | | License | MIT | Doc PR | Commits ------- 81ae635 drop support for retrieving container from non-booted kernels
2 parents b15ae9c + 81ae635 commit 5e48c39

File tree

3 files changed

+2
-25
lines changed

3 files changed

+2
-25
lines changed

src/Symfony/Component/HttpKernel/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ CHANGELOG
44
5.0.0
55
-----
66

7+
* removed support for getting the container from a non-booted kernel
78
* removed the first and second constructor argument of `ConfigDataCollector`
89
* removed `ConfigDataCollector::getApplicationName()`
910
* removed `ConfigDataCollector::getApplicationVersion()`

src/Symfony/Component/HttpKernel/Kernel.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ public function getProjectDir()
301301
public function getContainer()
302302
{
303303
if (!$this->booted) {
304-
@trigger_error('Getting the container from a non-booted kernel is deprecated since Symfony 4.4.', E_USER_DEPRECATED);
304+
throw new \LogicException('Cannot retrieve the container from a non-booted kernel.');
305305
}
306306

307307
return $this->container;

src/Symfony/Component/HttpKernel/Tests/KernelTest.php

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -47,18 +47,6 @@ public function testConstructor()
4747
$this->assertLessThanOrEqual(microtime(true), $kernel->getStartTime());
4848
}
4949

50-
/**
51-
* @group legacy
52-
* @expectedDeprecation Getting the container from a non-booted kernel is deprecated since Symfony 4.4.
53-
*/
54-
public function testGetContainerForANonBootedKernel()
55-
{
56-
$kernel = new KernelForTest('test_env', true);
57-
58-
$this->assertFalse($kernel->isBooted());
59-
$this->assertNull($kernel->getContainer());
60-
}
61-
6250
public function testClone()
6351
{
6452
$env = 'test_env';
@@ -407,18 +395,6 @@ public function testTerminateReturnsSilentlyIfKernelIsNotBooted()
407395
$kernel->terminate(Request::create('/'), new Response());
408396
}
409397

410-
/**
411-
* @group legacy
412-
* @expectedDeprecation Getting the container from a non-booted kernel is deprecated since Symfony 4.4.
413-
*/
414-
public function testDeprecatedNullKernel()
415-
{
416-
$kernel = $this->getKernel();
417-
$kernel->shutdown();
418-
419-
$this->assertNull($kernel->getContainer());
420-
}
421-
422398
public function testTerminateDelegatesTerminationOnlyForTerminableInterface()
423399
{
424400
// does not implement TerminableInterface

0 commit comments

Comments
 (0)