#!/usr/bin/env php 'Error', E_WARNING => 'Warning', E_PARSE => 'Parser Error', E_NOTICE => 'Notice', E_CORE_ERROR => 'Core Error', E_CORE_WARNING => 'Core Warning', E_COMPILE_ERROR => 'Compile Error', E_COMPILE_WARNING => 'Compile Warning', E_USER_ERROR => 'User Error', E_USER_WARNING => 'User Warning', E_USER_NOTICE => 'User notice', E_STRICT => 'Strict Notice', E_RECOVERABLE_ERROR => 'Recoverable Error' ]; if (0 === $errno) { return; } $message = sprintf('%s: %s (%s:%d).', $errorLevels[$number] ?? (string)$number, $error, $file, $line); fwrite(STDERR, trim($message) . PHP_EOL); exit(501); }); set_exception_handler(function (Throwable $e) { $message = sprintf('%s: %s (%s:%d).', get_class($e), $e->getMessage(), $e->getFile(), $e->getLine()); fwrite(STDERR, trim($message) . PHP_EOL); exit(502); }); if (!file_exists(__DIR__ . '/../vendor/autoload.php')) { fwrite(STDERR, 'Dependencies are missing.' . PHP_EOL); exit(Command::FAILURE); } require __DIR__ . '/../vendor/autoload.php'; try { $app = (new App\Libs\Initializer())->boot(); } catch (Throwable $e) { $message = sprintf('%s: %s (%s:%d).', get_class($e), $e->getMessage(), $e->getFile(), $e->getLine()); fwrite(STDERR, trim($message) . PHP_EOL); exit(503); } $app->console();