mirror of
https://github.com/danog/psalm.git
synced 2024-12-14 02:07:37 +01:00
b713066d32
By default, php will only print the first few thousand bytes of the exception, for an uncaught exception (I think that's the default, and not just my configuration) Instead, print all of the parts of the exception. For #1083 (this PR does not cover set_error_handler)
13 lines
473 B
PHP
13 lines
473 B
PHP
<?php
|
|
/**
|
|
* If there is an uncaught exception,
|
|
* then print more of the backtrace than is done by default to stderr,
|
|
* then exit with a non-zero exit code to indicate failure.
|
|
*/
|
|
set_exception_handler(static function (Throwable $throwable) : void {
|
|
fwrite(STDERR, "Uncaught $throwable\n");
|
|
$version = defined('PSALM_VERSION') ? PSALM_VERSION : '(unknown version)';
|
|
fwrite(STDERR, "(Psalm $version crashed due to an uncaught Throwable)\n");
|
|
exit(1);
|
|
});
|