[Console] Added Application::reset()

This commit is contained in:
Grégoire Pineau 2019-07-08 11:56:58 +02:00
parent 87a6f04409
commit 15ba5791cd
3 changed files with 23 additions and 4 deletions

View File

@ -55,6 +55,16 @@ class Application extends BaseApplication
return $this->kernel;
}
/**
* {@inheritdoc}
*/
public function reset()
{
if ($this->kernel->getContainer()->has('services_resetter')) {
$this->kernel->getContainer()->get('services_resetter')->reset();
}
}
/**
* Runs the current application.
*

View File

@ -45,6 +45,7 @@ use Symfony\Component\ErrorCatcher\ErrorHandler;
use Symfony\Component\ErrorCatcher\Exception\FatalThrowableError;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\EventDispatcher\LegacyEventDispatcherProxy;
use Symfony\Contracts\Service\ResetInterface;
/**
* An Application is the container for a collection of commands.
@ -61,7 +62,7 @@ use Symfony\Component\EventDispatcher\LegacyEventDispatcherProxy;
*
* @author Fabien Potencier <fabien@symfony.com>
*/
class Application
class Application implements ResetInterface
{
private $commands = [];
private $wantHelps = false;
@ -276,6 +277,13 @@ class Application
return $exitCode;
}
/**
* {@inheritdoc}
*/
public function reset()
{
}
public function setHelperSet(HelperSet $helperSet)
{
$this->helperSet = $helperSet;

View File

@ -6,6 +6,7 @@ CHANGELOG
* added `Question::setTrimmable` default to true to allow the answer to be trimmed
* added method `preventRedrawFasterThan()` and `forceRedrawSlowerThan()` on `ProgressBar`
* `Application` implements `ResetInterface`
4.3.0
-----
@ -38,7 +39,7 @@ CHANGELOG
* `OutputFormatter` throws an exception when unknown options are used
* removed `QuestionHelper::setInputStream()/getInputStream()`
* removed `Application::getTerminalWidth()/getTerminalHeight()` and
* removed `Application::getTerminalWidth()/getTerminalHeight()` and
`Application::setTerminalDimensions()/getTerminalDimensions()`
* removed `ConsoleExceptionEvent`
* removed `ConsoleEvents::EXCEPTION`
@ -64,7 +65,7 @@ CHANGELOG
with value optional explicitly passed empty
* added console.error event to catch exceptions thrown by other listeners
* deprecated console.exception event in favor of console.error
* added ability to handle `CommandNotFoundException` through the
* added ability to handle `CommandNotFoundException` through the
`console.error` event
* deprecated default validation in `SymfonyQuestionHelper::ask`
@ -80,7 +81,7 @@ CHANGELOG
-----
* added truncate method to FormatterHelper
* added setColumnWidth(s) method to Table
* added setColumnWidth(s) method to Table
2.8.3
-----