Skip to content

Commit dba7532

Browse files
committed
Add disable exit code method
1 parent 9b9fa19 commit dba7532

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

src/Handlers/AbstractHandler.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ abstract class AbstractHandler implements HandlerInterface
2828
protected const MAX_TRACE_LENGTH = 40;
2929

3030
protected bool $throwException = true;
31-
protected bool $disableExitCode = false;
31+
protected static bool $disableExitCode = false;
3232
protected ?HttpMessagingInterface $http = null;
3333
protected ?Closure $eventCallable = null;
3434
protected int $severity = E_ALL;
@@ -49,7 +49,7 @@ abstract protected function getCodeBlock(array $data, string $code, int $index =
4949
*/
5050
public function disableExitCode(bool $disable = true): self
5151
{
52-
$this->disableExitCode = $disable;
52+
self::$disableExitCode = $disable;
5353
return $this;
5454
}
5555

@@ -142,7 +142,8 @@ public function shutdownHandler(): void
142142
);
143143
}
144144
}
145-
exit((int)(!$this->disableExitCode));
145+
146+
exit((int)(!self::$disableExitCode));
146147
}
147148

148149

@@ -201,7 +202,7 @@ protected function emitter(throwable $exception, ?ExceptionItem $exceptionItem =
201202
}
202203
$stream->rewind();
203204
echo $stream->read((int)$stream->getSize());
204-
exit((int)(!$this->disableExitCode));
205+
exit((int)(!self::$disableExitCode));
205206
}
206207

207208
/**

tests/unitary-blunder.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@
2121
$run = new Run(new SilentHandler());
2222
$run->disableExitCode();
2323
$run->event(function ($item, $http) use ($inst) {
24-
25-
2624
$inst->add($item->getStatus(), function () {
2725
return $this->equal("warning");
2826

0 commit comments

Comments
 (0)