@@ -80,16 +80,22 @@ discard block |
||
| 80 | 80 | $console = $this->container->get(Console::class); |
| 81 | 81 | |
| 82 | 82 | $code = 0; |
| 83 | - try { |
|
| 83 | + try |
|
| 84 | + { |
|
| 84 | 85 | $code = $console->start($input ?? new ArgvInput(), $output); |
| 85 | - } catch (Throwable $e) { |
|
| 86 | + } |
|
| 87 | + catch (Throwable $e) |
|
| 88 | + { |
|
| 86 | 89 | $this->handleException($e, $output); |
| 87 | - } finally { |
|
| 90 | + } |
|
| 91 | + finally |
|
| 92 | + { |
|
| 88 | 93 | $listener->disable(); |
| 89 | 94 | $this->finalizer->finalize(false); |
| 90 | 95 | } |
| 91 | 96 | |
| 92 | - if ($exit) { |
|
| 97 | + if ($exit) |
|
| 98 | + { |
|
| 93 | 99 | exit($code); |
| 94 | 100 | } |
| 95 | 101 | } |
@@ -100,9 +106,12 @@ discard block |
||
| 100 | 106 | */ |
| 101 | 107 | protected function handleException(Throwable $e, OutputInterface $output): void |
| 102 | 108 | { |
| 103 | - try { |
|
| 109 | + try |
|
| 110 | + { |
|
| 104 | 111 | $this->container->get(SnapshotterInterface::class)->register($e); |
| 105 | - } catch (Throwable | ContainerExceptionInterface $se) { |
|
| 112 | + } |
|
| 113 | + catch (Throwable | ContainerExceptionInterface $se) |
|
| 114 | + { |
|
| 106 | 115 | // no need to notify when unable to register an exception |
| 107 | 116 | } |
| 108 | 117 | |
@@ -117,11 +126,13 @@ discard block |
||
| 117 | 126 | */ |
| 118 | 127 | private function mapVerbosity(OutputInterface $output): int |
| 119 | 128 | { |
| 120 | - if ($output->isDebug()) { |
|
| 129 | + if ($output->isDebug()) |
|
| 130 | + { |
|
| 121 | 131 | return ConsoleHandler::VERBOSITY_DEBUG; |
| 122 | 132 | } |
| 123 | 133 | |
| 124 | - if ($output->isVeryVerbose()) { |
|
| 134 | + if ($output->isVeryVerbose()) |
|
| 135 | + { |
|
| 125 | 136 | return ConsoleHandler::VERBOSITY_VERBOSE; |
| 126 | 137 | } |
| 127 | 138 | |