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

Skip to content

[HttpKernel] drop support for retrieving container from non-booted kernels #33760

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 30, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/Symfony/Component/HttpKernel/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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()`
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Component/HttpKernel/Kernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ public function getProjectDir()
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;
Expand Down
24 changes: 0 additions & 24 deletions src/Symfony/Component/HttpKernel/Tests/KernelTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,18 +47,6 @@ public function testConstructor()
$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';
Expand Down Expand Up @@ -407,18 +395,6 @@ public function testTerminateReturnsSilentlyIfKernelIsNotBooted()
$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
Expand Down