Skip to content

Commit 15ba579

Browse files
committed
[Console] Added Application::reset()
1 parent 87a6f04 commit 15ba579

File tree

3 files changed

+23
-4
lines changed

3 files changed

+23
-4
lines changed

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,16 @@ public function getKernel()
5555
return $this->kernel;
5656
}
5757

58+
/**
59+
* {@inheritdoc}
60+
*/
61+
public function reset()
62+
{
63+
if ($this->kernel->getContainer()->has('services_resetter')) {
64+
$this->kernel->getContainer()->get('services_resetter')->reset();
65+
}
66+
}
67+
5868
/**
5969
* Runs the current application.
6070
*

src/Symfony/Component/Console/Application.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
use Symfony\Component\ErrorCatcher\Exception\FatalThrowableError;
4646
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
4747
use Symfony\Component\EventDispatcher\LegacyEventDispatcherProxy;
48+
use Symfony\Contracts\Service\ResetInterface;
4849

4950
/**
5051
* An Application is the container for a collection of commands.
@@ -61,7 +62,7 @@
6162
*
6263
* @author Fabien Potencier <fabien@symfony.com>
6364
*/
64-
class Application
65+
class Application implements ResetInterface
6566
{
6667
private $commands = [];
6768
private $wantHelps = false;
@@ -276,6 +277,13 @@ public function doRun(InputInterface $input, OutputInterface $output)
276277
return $exitCode;
277278
}
278279

280+
/**
281+
* {@inheritdoc}
282+
*/
283+
public function reset()
284+
{
285+
}
286+
279287
public function setHelperSet(HelperSet $helperSet)
280288
{
281289
$this->helperSet = $helperSet;

src/Symfony/Component/Console/CHANGELOG.md

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

77
* added `Question::setTrimmable` default to true to allow the answer to be trimmed
88
* added method `preventRedrawFasterThan()` and `forceRedrawSlowerThan()` on `ProgressBar`
9+
* `Application` implements `ResetInterface`
910

1011
4.3.0
1112
-----
@@ -38,7 +39,7 @@ CHANGELOG
3839

3940
* `OutputFormatter` throws an exception when unknown options are used
4041
* removed `QuestionHelper::setInputStream()/getInputStream()`
41-
* removed `Application::getTerminalWidth()/getTerminalHeight()` and
42+
* removed `Application::getTerminalWidth()/getTerminalHeight()` and
4243
`Application::setTerminalDimensions()/getTerminalDimensions()`
4344
* removed `ConsoleExceptionEvent`
4445
* removed `ConsoleEvents::EXCEPTION`
@@ -64,7 +65,7 @@ CHANGELOG
6465
with value optional explicitly passed empty
6566
* added console.error event to catch exceptions thrown by other listeners
6667
* deprecated console.exception event in favor of console.error
67-
* added ability to handle `CommandNotFoundException` through the
68+
* added ability to handle `CommandNotFoundException` through the
6869
`console.error` event
6970
* deprecated default validation in `SymfonyQuestionHelper::ask`
7071

@@ -80,7 +81,7 @@ CHANGELOG
8081
-----
8182

8283
* added truncate method to FormatterHelper
83-
* added setColumnWidth(s) method to Table
84+
* added setColumnWidth(s) method to Table
8485

8586
2.8.3
8687
-----

0 commit comments

Comments
 (0)