private function registerShutdownHandler()
{
register_shutdown_function(function () {
if (!($err = \error_get_last())) {
return;
}
switch ($err["type"]) {
case E_ERROR:
case E_PARSE:
case E_USER_ERROR:
case E_CORE_ERROR:
case E_CORE_WARNING:
case E_COMPILE_ERROR:
case E_COMPILE_WARNING:
case E_RECOVERABLE_ERROR:
break;
default:
return;
}
$this->exitCode = 1;
$msg = "{$err["message"]} in {$err["file"]} on line {$err["line"]}";
// FIXME: Fatal error: Uncaught LogicException: Cannot run() recursively; event reactor already active
\Amp\run(function () use($msg) {
$this->logger->critical($msg);
yield from $this->stop();
});
});
}