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
-------
81ae635100
drop support for retrieving container from non-booted kernels
This commit is contained in:
commit
5e48c39f79
@ -4,6 +4,7 @@ CHANGELOG
|
|||||||
5.0.0
|
5.0.0
|
||||||
-----
|
-----
|
||||||
|
|
||||||
|
* removed support for getting the container from a non-booted kernel
|
||||||
* removed the first and second constructor argument of `ConfigDataCollector`
|
* removed the first and second constructor argument of `ConfigDataCollector`
|
||||||
* removed `ConfigDataCollector::getApplicationName()`
|
* removed `ConfigDataCollector::getApplicationName()`
|
||||||
* removed `ConfigDataCollector::getApplicationVersion()`
|
* removed `ConfigDataCollector::getApplicationVersion()`
|
||||||
|
@ -301,7 +301,7 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl
|
|||||||
public function getContainer()
|
public function getContainer()
|
||||||
{
|
{
|
||||||
if (!$this->booted) {
|
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;
|
return $this->container;
|
||||||
|
@ -47,18 +47,6 @@ class KernelTest extends TestCase
|
|||||||
$this->assertLessThanOrEqual(microtime(true), $kernel->getStartTime());
|
$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()
|
public function testClone()
|
||||||
{
|
{
|
||||||
$env = 'test_env';
|
$env = 'test_env';
|
||||||
@ -407,18 +395,6 @@ EOF;
|
|||||||
$kernel->terminate(Request::create('/'), new Response());
|
$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()
|
public function testTerminateDelegatesTerminationOnlyForTerminableInterface()
|
||||||
{
|
{
|
||||||
// does not implement TerminableInterface
|
// does not implement TerminableInterface
|
||||||
|
Reference in New Issue
Block a user