static function error2exception()
    {
        set_error_handler(
            function ($errno, $errstr, $errfile, $errline) {
                $r = error_reporting();
                if ($r & $errno) {
                    $exception = new \ErrorException($errstr, null, $errno,
                        $errfile, $errline);
                    if ($errno == E_USER_ERROR || $errno == E_RECOVERABLE_ERROR) {
                        throw $exception;
                    }
                    static::catchException($exception);
                }
            });
    }
static function error2exception()
    {
        set_error_handler(
            function ($errno, $errstr, $errfile, $errline) {
                $r = error_reporting();
                if ($r & $errno) {
                    $exception = new \ErrorException($errstr, null, $errno,
                        $errfile, $errline);
                    if ($errno == E_USER_ERROR || $errno == E_RECOVERABLE_ERROR) {
                        throw $exception;
                    }
                    static::catchException($exception);
                }
            });
    }
static function error2exception ( ) { set_error_handler ( function ( $ errno , $ errstr , $ errfile , $ errline ) { $ r = error_reporting ( ) ; if ( $ r & $ errno ) { $ exception = new \ ErrorException ( $ errstr , null , $ errno , $ errfile , $ errline ) ; if ( $ errno == E_USER_ERROR || $ errno == E_RECOVERABLE_ERROR ) { throw $ exception ; } static :: catchException ( $ exception ) ; } } ) ; }
error to exception

@throws \ErrorException
error to exception