Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 8805cfd

Browse filesBrowse files
committed
[Console] simplified code
1 parent a69e756 commit 8805cfd
Copy full SHA for 8805cfd

File tree

Expand file treeCollapse file tree

1 file changed

+11
-21
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+11
-21
lines changed

‎src/Symfony/Component/Console/Application.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Console/Application.php
+11-21Lines changed: 11 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,17 @@ public function run(InputInterface $input = null, OutputInterface $output = null
153153

154154
$renderException($e);
155155

156-
$exitCode = $this->getExitCodeForThrowable($e);
156+
$exitCode = $e->getCode();
157+
if (is_numeric($exitCode)) {
158+
$exitCode = (int) $exitCode;
159+
if (0 === $exitCode) {
160+
$exitCode = 1;
161+
}
162+
} else {
163+
$exitCode = 1;
164+
}
165+
166+
return $exitCode;
157167
} finally {
158168
// if the exception handler changed, keep it
159169
// otherwise, unregister $renderException
@@ -1212,24 +1222,4 @@ private function init()
12121222
$this->add($command);
12131223
}
12141224
}
1215-
1216-
/**
1217-
* @param \Exception|\Throwable $throwable
1218-
*
1219-
* @return int
1220-
*/
1221-
private function getExitCodeForThrowable($throwable)
1222-
{
1223-
$exitCode = $throwable->getCode();
1224-
if (is_numeric($exitCode)) {
1225-
$exitCode = (int) $exitCode;
1226-
if (0 === $exitCode) {
1227-
$exitCode = 1;
1228-
}
1229-
} else {
1230-
$exitCode = 1;
1231-
}
1232-
1233-
return $exitCode;
1234-
}
12351225
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.