code: private function register()
      {
          // Don't display any errors since we want this error handler to handle all
          // errors. Error messages sent to the client will be serialized.
          ini_set('display_errors', false);
  
          // In development however it is beneficiary to display errors.
          if ($this->displayErrors) {
              ini_set('display_errors', true);
          }
  
          // Register handlers
          register_shutdown_function([$this, 'shutdownHandler']);
          set_error_handler([$this, 'errorHandler']);
          set_exception_handler([$this, 'exceptionHandler']);
      }
docs: Register error, exception and shutdown handlers