Skip to content

Commit 0b6cdd9

Browse files
authored
load only CLiErrorHandler for cli request: (#187)
2 parents d313900 + e866ab5 commit 0b6cdd9

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

src/Phaseolies/Error/Factory/ErrorHandlerFactory.php

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,14 @@ class ErrorHandlerFactory
1616
*/
1717
public static function createHandlers(): array
1818
{
19-
return [
20-
new JsonErrorHandler(),
21-
new CliErrorHandler(),
22-
new WebErrorHandler(),
23-
];
19+
$handlers = [new CliErrorHandler()];
20+
21+
if (PHP_SAPI !== 'cli' && !defined('STDIN')) {
22+
$handlers[] = new JsonErrorHandler();
23+
$handlers[] = new WebErrorHandler();
24+
}
25+
26+
return $handlers;
2427
}
2528

2629
/**

0 commit comments

Comments
 (0)