code: public function onShutdown(Event $event)
      {
          if (!$this->registered) {
              return;
          }
          $error = $event['error'] ?: \error_get_last();
          if (!$error) {
              return;
          }
          if (\in_array($error['type'], $this->errCategories['fatal'])) {
              /*
                  found in wild:
                  @include(some_file_with_parse_error)
                  which will trigger a fatal error (here we are),
                  but error_reporting() will return 0 due to the @ operator
                  unsupress fatal error here
              */
              \error_reporting(E_ALL | E_STRICT);
              $this->handleError($error['type'], $error['message'], $error['file'], $error['line']);
          }
          /*
              Find the fatal error/uncaught-exception and attach to shutdown event
          */
          foreach ($this->data['errors'] as $error) {
              if ($error['category'] === 'fatal') {
                  $event['error'] = $error;
                  break;
              }
          }
          return;
      }
docs: php.shutdown event subscriber
  
  Used to handle fatal errors
  
  Test fatal error handling by publishing 'php.shutdown' event with error value
  
  @param Event $event php.shutdown event
  
  @return void