Remove collision, it's useless at all

This commit is contained in:
crazywhalecc
2025-08-01 01:29:35 +08:00
parent 07d66ade85
commit 6b381238fe
3 changed files with 108 additions and 353 deletions

View File

@@ -10,20 +10,6 @@ class ExceptionHandler
private static ?ExceptionHandler $obj = null;
private function __construct()
{
$whoops_class = 'Whoops\Run';
$collision_class = 'NunoMaduro\Collision\Handler';
if (class_exists($collision_class) && class_exists($whoops_class)) {
/* @phpstan-ignore-next-line */
$this->whoops = new $whoops_class();
$this->whoops->allowQuit(false);
$this->whoops->writeToOutput(false);
$this->whoops->pushHandler(new $collision_class());
$this->whoops->register();
}
}
public static function getInstance(): ExceptionHandler
{
if (self::$obj === null) {
@@ -34,13 +20,8 @@ class ExceptionHandler
public function handle(\Throwable $e): void
{
if (is_null($this->whoops)) {
logger()->error('Uncaught ' . get_class($e) . ': ' . $e->getMessage() . ' at ' . $e->getFile() . '(' . $e->getLine() . ')');
logger()->error($e->getTraceAsString());
return;
}
$this->whoops->handleException($e);
logger()->error('Uncaught ' . get_class($e) . ': ' . $e->getMessage() . ' at ' . $e->getFile() . '(' . $e->getLine() . ')');
logger()->error($e->getTraceAsString());
logger()->critical('You can report this exception to static-php-cli GitHub repo.');
}
}