@@ -28,15 +28,15 @@ discard block |
||
| 28 | 28 | * @param int|null $bitmask |
| 29 | 29 | */ |
| 30 | 30 | public static function enableExceptionsForErrors($bitmask = null) { |
| 31 | - set_error_handler(function ($level, $message, $file, $line) use ($bitmask) { |
|
| 31 | + set_error_handler(function($level, $message, $file, $line) use ($bitmask) { |
|
| 32 | 32 | // PHP-7 fix: What once was an E_STRICT is now an E_WARNING: |
| 33 | - if(preg_match('/^Declaration of .*? should be compatible with/', $message)) { |
|
| 33 | + if (preg_match('/^Declaration of .*? should be compatible with/', $message)) { |
|
| 34 | 34 | $level = E_STRICT; |
| 35 | 35 | } |
| 36 | 36 | if (0 === error_reporting()) { |
| 37 | 37 | return false; |
| 38 | 38 | } |
| 39 | - if($bitmask & $level) { |
|
| 39 | + if ($bitmask & $level) { |
|
| 40 | 40 | throw new ErrorException($message, 0, $level, $file, $line); |
| 41 | 41 | } |
| 42 | 42 | }); |
@@ -48,11 +48,11 @@ discard block |
||
| 48 | 48 | */ |
| 49 | 49 | public static function registerAssertionHandler(LoggerInterface $logger, $logLevel) { |
| 50 | 50 | static $errorLogger = null; |
| 51 | - if($errorLogger === null) { |
|
| 51 | + if ($errorLogger === null) { |
|
| 52 | 52 | $errorLogger = new LoggerCollection(); |
| 53 | 53 | assert_options(ASSERT_ACTIVE, true); |
| 54 | 54 | assert_options(ASSERT_WARNING, false); |
| 55 | - assert_options(ASSERT_CALLBACK, function ($file, $line, $message) use ($errorLogger, $logLevel) { |
|
| 55 | + assert_options(ASSERT_CALLBACK, function($file, $line, $message) use ($errorLogger, $logLevel) { |
|
| 56 | 56 | $errorLogger->log($logLevel, $message, array( |
| 57 | 57 | 'file' => $file, |
| 58 | 58 | 'line' => $line |
@@ -67,12 +67,12 @@ discard block |
||
| 67 | 67 | */ |
| 68 | 68 | public static function registerFatalErrorHandler(LoggerInterface $logger) { |
| 69 | 69 | static $errorLogger = null; |
| 70 | - if($errorLogger === null) { |
|
| 70 | + if ($errorLogger === null) { |
|
| 71 | 71 | $errorLogger = new LoggerCollection(); |
| 72 | 72 | $errorLevels = self::$phpErrorLevels; |
| 73 | - register_shutdown_function(function () use ($errorLogger, $errorLevels) { |
|
| 73 | + register_shutdown_function(function() use ($errorLogger, $errorLevels) { |
|
| 74 | 74 | $error = error_get_last(); |
| 75 | - if($error !== null && $error['type'] === E_ERROR) { |
|
| 75 | + if ($error !== null && $error['type'] === E_ERROR) { |
|
| 76 | 76 | $errorLogger = new LogLevelRangeFilter($errorLogger, LogLevel::ERROR); |
| 77 | 77 | $errorLogger->log(LogLevel::ALERT, $error['message'], $error); |
| 78 | 78 | } |
@@ -86,13 +86,13 @@ discard block |
||
| 86 | 86 | */ |
| 87 | 87 | public static function registerExceptionHandler(LoggerInterface $logger) { |
| 88 | 88 | static $errorLogger = null; |
| 89 | - if($errorLogger === null) { |
|
| 89 | + if ($errorLogger === null) { |
|
| 90 | 90 | $errorLogger = new LoggerCollection(); |
| 91 | - set_exception_handler(function ($exception) use ($errorLogger) { |
|
| 91 | + set_exception_handler(function($exception) use ($errorLogger) { |
|
| 92 | 92 | /** @var \Exception|\Throwable $exception */ |
| 93 | 93 | $errorLogger = new LogLevelRangeFilter($errorLogger, LogLevel::ERROR); |
| 94 | 94 | $errorLogger->log(LogLevel::CRITICAL, $exception->getMessage(), array('exception' => $exception)); |
| 95 | - if($exception instanceof Exception) { |
|
| 95 | + if ($exception instanceof Exception) { |
|
| 96 | 96 | StackTracePrinter::printException($exception, "PHP Fatal Error: Uncaught exception: "); |
| 97 | 97 | die(1); |
| 98 | 98 | } |