Skip to content

Commit fa26c2d

Browse files
committed
[HttpKernel+FrameworkBundle] Added Kernel::reset() and Console\Application::reset()
1 parent 6811aaa commit fa26c2d

File tree

6 files changed

+30
-6
lines changed

6 files changed

+30
-6
lines changed

src/Symfony/Bundle/FrameworkBundle/CHANGELOG.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ CHANGELOG
99
* Deprecated the `controller_name_converter` and `resolve_controller_name_subscriber` services
1010
* The `ControllerResolver` and `DelegatingLoader` classes have been marked as `final`
1111
* Added support for configuring chained cache pools
12+
* `Application` implements `ResetInterface`
1213

1314
4.3.0
1415
-----
@@ -34,8 +35,8 @@ CHANGELOG
3435
options if you're using Symfony's serializer.
3536
* [BC Break] Removed the `framework.messenger.routing.send_and_handle` configuration.
3637
Instead of setting it to true, configure a `SyncTransport` and route messages to it.
37-
* Added information about deprecated aliases in `debug:autowiring`
38-
* Added php ini session options `sid_length` and `sid_bits_per_character`
38+
* Added information about deprecated aliases in `debug:autowiring`
39+
* Added php ini session options `sid_length` and `sid_bits_per_character`
3940
to the `session` section of the configuration
4041
* Added support for Translator paths, Twig paths in translation commands.
4142
* Added support for PHP files with translations in translation commands.

src/Symfony/Bundle/FrameworkBundle/Console/Application.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,12 @@
2424
use Symfony\Component\HttpKernel\Bundle\Bundle;
2525
use Symfony\Component\HttpKernel\Kernel;
2626
use Symfony\Component\HttpKernel\KernelInterface;
27+
use Symfony\Contracts\Service\ResetInterface;
2728

2829
/**
2930
* @author Fabien Potencier <fabien@symfony.com>
3031
*/
31-
class Application extends BaseApplication
32+
class Application extends BaseApplication implements ResetInterface
3233
{
3334
private $kernel;
3435
private $commandsRegistered = false;
@@ -55,6 +56,14 @@ public function getKernel()
5556
return $this->kernel;
5657
}
5758

59+
/**
60+
* {@inheritdoc}
61+
*/
62+
public function reset()
63+
{
64+
$this->kernel->reset();
65+
}
66+
5867
/**
5968
* Runs the current application.
6069
*

src/Symfony/Bundle/FrameworkBundle/composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
"ext-xml": "*",
2121
"symfony/cache": "^4.4|^5.0",
2222
"symfony/config": "^4.2|^5.0",
23+
"symfony/contracts": "~1.0",
2324
"symfony/dependency-injection": "^4.4|^5.0",
2425
"symfony/error-catcher": "^4.4|^5.0",
2526
"symfony/http-foundation": "^4.3|^5.0",

src/Symfony/Component/HttpKernel/CHANGELOG.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ CHANGELOG
55
-----
66

77
* The `DebugHandlersListener` class has been marked as `final`
8+
* `HttpKernel` implements `ResetInterface`
89

910
4.3.0
1011
-----
@@ -36,8 +37,8 @@ CHANGELOG
3637

3738
* deprecated `KernelInterface::getRootDir()` and the `kernel.root_dir` parameter
3839
* deprecated `KernelInterface::getName()` and the `kernel.name` parameter
39-
* deprecated the first and second constructor argument of `ConfigDataCollector`
40-
* deprecated `ConfigDataCollector::getApplicationName()`
40+
* deprecated the first and second constructor argument of `ConfigDataCollector`
41+
* deprecated `ConfigDataCollector::getApplicationName()`
4142
* deprecated `ConfigDataCollector::getApplicationVersion()`
4243

4344
4.1.0

src/Symfony/Component/HttpKernel/Kernel.php

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
use Symfony\Component\HttpKernel\Config\FileLocator;
3737
use Symfony\Component\HttpKernel\DependencyInjection\AddAnnotatedClassesToCachePass;
3838
use Symfony\Component\HttpKernel\DependencyInjection\MergeExtensionConfigurationPass;
39+
use Symfony\Contracts\Service\ResetInterface;
3940

4041
/**
4142
* The Kernel is the heart of the Symfony system.
@@ -47,7 +48,7 @@
4748
*
4849
* @author Fabien Potencier <fabien@symfony.com>
4950
*/
50-
abstract class Kernel implements KernelInterface, RebootableInterface, TerminableInterface
51+
abstract class Kernel implements KernelInterface, RebootableInterface, TerminableInterface, ResetInterface
5152
{
5253
/**
5354
* @var BundleInterface[]
@@ -150,6 +151,16 @@ public function reboot($warmupDir)
150151
$this->boot();
151152
}
152153

154+
/**
155+
* {@inheritdoc}
156+
*/
157+
public function reset()
158+
{
159+
if ($this->container->has('services_resetter')) {
160+
$this->container->get('services_resetter')->reset();
161+
}
162+
}
163+
153164
/**
154165
* {@inheritdoc}
155166
*/

src/Symfony/Component/HttpKernel/composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
],
1818
"require": {
1919
"php": "^7.1.3",
20+
"symfony/contracts": "~1.0",
2021
"symfony/error-catcher": "^4.4|^5.0",
2122
"symfony/event-dispatcher": "^4.3",
2223
"symfony/http-foundation": "^4.4|^5.0",

0 commit comments

Comments
 (0)