Register an error handler for fatal errors.

@param  Closure  $callback
@return void
160662
public function fatal(Closure $callback)
	{
		$this->error(function(FatalErrorException $e) use ($callback)
		{
			return call_user_func($callback, $e);
		});
	}
233267
protected static function invokeWithErrorHandler(callable $callback, ...$args)
	{
		if(self::$errorHandler === NULL)
		{
			self::$errorHandler = function ($type, $message, $file, $line) {
				throw new \RuntimeException($message);
			};
		}
		
		set_error_handler(self::$errorHandler);
		
		try
		{
			return $callback(...$args);
		}
		finally
		{
			restore_error_handler();
		}
	}
618738
public function missing(Closure $callback)
	{
		$this->error(function(NotFoundHttpException $e) use ($callback)
		{
			return call_user_func($callback, $e);
		});
	}
514228
protected function afterResolvingCallback(Closure $callback)
    {
        $abstract = $this->getFunctionHint($callback);

        if ($abstract) {
            $this->afterResolvingCallbacks[$abstract][] = $callback;
        } else {
            $this->globalAfterResolvingCallbacks[] = $callback;
        }
    }
131211
protected function registerEvent($name, Closure $callback)
    {
        if (! isset(static::$dispatcher)) {
            $this->initEventDispatcher();
        }

        static::$dispatcher->listen($name, $callback);
    }
1110398
public function after(Closure $callback = null)
    {
        if ($callback && $this->booted()) {
            $this->container->call($callback);
        }

        $this->eventDispatcher->listen(BootedAll::class, $callback);
        $this->eventDispatcher->listen('antares.extension: booted', $callback);
        $this->eventDispatcher->listen(ComponentsBooted::class, $callback);
    }
1208936
public function onSuccess(Closure $callback)
    {
        return $this->then(function (Container $container) use ($callback) {
            if (0 === $this->exitCode) {
                $container->call($callback);
            }
        });
    }
301918
public function cliRegister() : Closure
  {
    return function($exception, $inspector, $run) {
      Output::error($exception);
      die($exception . PHP_EOL);
      exit;
    };
  }
1121714
function fatal_handler()
    {
        $error = error_get_last();
        if ($error !== null && $error['type'] == E_ERROR) {
            $errno   = $error["type"];
            $errfile = $error["file"];
            $errline = $error["line"];
            $errstr  = $error["message"];
            Log::info("Error ($errno) in $errfile on line $errline: $errstr");
            header("HTTP/1.1 500 Internal Server Error");
        }
    }
713363
public function mapSurname(Closure $callback)
    {
        if (!static::$surnamesHandle instanceof SplFileObject) {
            static::$surnamesHandle = $this->openFile($this->path.'/surnames');
        }

        $this->traversing($this->getGenerator([static::$surnamesHandle]), $callback);
    }
518146
public function mapSurname(Closure $callback)
    {
        if (empty($this->surnames)) {
            $surnames = $this->path.'/surnames';

            if (file_exists($surnames)) {
                $this->surnames = (array) include $surnames;
            }
        }

        $callback($this->surnames);
    }
1242380
public function warning(callable $callback)
    {
        $this->registerError(E_WARNING, $callback);
        $this->registerError(E_USER_WARNING, $callback);
        $this->registerError(E_CORE_WARNING, $callback);
        $this->registerError(E_COMPILE_WARNING, $callback);
    }
385533
public function registerCallback(EventCallbackInterface $callback)
    {
        if (!in_array($callback, $this->callbacks)) {
            $this->callbacks[] = $callback;
        }
    }
673870
public function handle($callback = null, $errorsCallback = null)
    {
        if ($this->posted()) {
            $errors = $this->check();

            if (!$errors) {
                if (null !== $callback) {
                    $callback($this->getData());
                }
            } else {
                if (null !== $errorsCallback) {
                    $errorsCallback($errors);
                }
                return $errors;
            }
        }

        return array();
    }
392039
public function handleRemaining(callable $callback)
    {
        $properties = $this->getRemainingMutations();
        if (!$properties) {
            // Nothing to do, don't register callback
            return;
        }

        foreach ($properties as $propertyName) {
            // HTTP Accepted
            $this->result[$propertyName] = 202;

            $this->propertyUpdateCallbacks[] = [
                $properties,
                $callback,
            ];
        }
    }
580643
public function setCallback($callback)
    {
        if (!$callback instanceof Closure) {
            throw new Exception\InvalidArgumentException(sprintf(
                'Invalid parameter for callback: must be %s',
                Closure::class
            ));
        }

        return parent::setCallback($callback);
    }
1150801
private function cacheSpammers(Closure $callback)
    {
        return cache()->remember($this->cacheKey, $this->cacheExpires, $callback);
    }