Determine if an error code or Exception is a fatal error.
@param  \Exception|integer  $error
@return boolean
961629
protected static function isFatal( $error ) {

		if( $error instanceof \Exception )
			return false;

		$fatal = E_ERROR | E_PARSE | E_CORE_ERROR | E_COMPILE_ERROR | E_USER_ERROR;

		if( $error instanceof \ErrorException )
			$error = $error->getSeverity();

		return (bool) ($error & $fatal);

	}
1232160
public function fatalHandler()
    {
        $error = $this->getLastError();
        
        if ($this->isRegistered() && $this->isFatalError($error)) {
            if (defined('FRAMEWORK_PATH')) {
                chdir(FRAMEWORK_PATH);
            }

            if ($this->isMemoryExhaustedError($error)) {
                // We can safely change the memory limit be the reserve amount because if suhosin is relevant
                // the memory will have been decreased prior to exhaustion
                $this->changeMemoryLimit($this->reserveMemory);
            }

            $exception = $this->createException(
                $error['message'],
                $error['type'],
                $error['file'],
                $error['line']
            );

            $context = array(
                'file' => $error['file'],
                'line' => $error['line']
            );

            if ($this->reportBacktrace) {
                $context['backtrace'] = $this->getBacktraceReporter()->getBacktrace();
            }

            if ($this->exceptionInContext) {
                $context['exception'] = $exception;
            }

            $this->logger->critical($error['message'], $context);

            // Fatal errors should be reported when live as they stop the display of regular output
            if ($this->showErrors || $this->getEnvReporter()->isLive()) {
                $this->getErrorReporter()->reportError($exception);
            }
        }
    }
64101
protected function _tokenError($error = 'tokenNotFound')
    {
        $subject = $this->_subject(['success' => false]);
        $this->_trigger($error, $subject);

        $message = $this->message($error, compact('token'));
        $exceptionClass = $message['class'];
        throw new $exceptionClass($message['text'], $message['code']);
    }
957154
public static function assertIsNumber($variable, Throwable $exception): bool
    {
        static::makeAssertion(\is_int($variable) || \is_float($variable), $exception);
        return true;
    }
1167903
public function validate(&$error = null)
    {
        if (!$this->isCountryCodeValid()) {
            $error = 'IBAN country code not valid or not supported';
        } elseif (!$this->isLengthValid()) {
            $error = 'IBAN length is invalid';
        } elseif (!$this->isFormatValid()) {
            $error = 'IBAN format is invalid';
        } elseif (!$this->isChecksumValid()) {
            $error = 'IBAN checksum is invalid';
        } else {
            $error = '';
            return true;
        }

        return false;
    }
240537
protected function fail($error = '')
    {
        $this->isFinished = true;
        $this->isSuccess = false;
        $this->error = $error;
    }
137667
public function handleException($exception, array $error = null)
    {
        if (null === $error) {
            self::$exitCode = 255;
        }
        if (!$exception instanceof \Exception) {
            $exception = new FatalThrowableError($exception);
        }
        $type = $exception instanceof FatalErrorException ? $exception->getSeverity() : E_ERROR;

        if (($this->loggedErrors & $type) || $exception instanceof FatalThrowableError) {
            if ($exception instanceof FatalErrorException) {
                if ($exception instanceof FatalThrowableError) {
                    $error = array(
                        'type' => $type,
                        'message' => $message = $exception->getMessage(),
                        'file' => $exception->getFile(),
                        'line' => $exception->getLine(),
                    );
                } else {
                    $message = 'Fatal '.$exception->getMessage();
                }
            } elseif ($exception instanceof \ErrorException) {
                $message = 'Uncaught '.$exception->getMessage();
            } else {
                $message = 'Uncaught Exception: '.$exception->getMessage();
            }
        }
        if ($this->loggedErrors & $type) {
            try {
                $this->loggers[$type][0]->log($this->loggers[$type][1], $message, array('exception' => $exception));
            } catch (\Exception $handlerException) {
            } catch (\Throwable $handlerException) {
            }
        }
        if ($exception instanceof FatalErrorException && !$exception instanceof OutOfMemoryException && $error) {
            foreach ($this->getFatalErrorHandlers() as $handler) {
                if ($e = $handler->handleError($error, $exception)) {
                    $exception = $e;
                    break;
                }
            }
        }
        if (empty($this->exceptionHandler)) {
            throw $exception; // Give back $exception to the native handler
        }
        try {
            call_user_func($this->exceptionHandler, $exception);
        } catch (\Exception $handlerException) {
        } catch (\Throwable $handlerException) {
        }
        if (isset($handlerException)) {
            $this->exceptionHandler = null;
            $this->handleException($handlerException);
        }
    }
466898
public function isValid($value)
    {
        if (!is_string($value)) {
            $this->_error(self::INVALID);
            return false;
        }

        $this->_setValue($value);
        if ($this->_encoding !== null) {
            $length = iconv_strlen($value, $this->_encoding);
        } else {
            $length = iconv_strlen($value);
        }

        if ($length < $this->_min) {
            $this->_error(self::TOO_SHORT);
        }

        if (null !== $this->_max && $this->_max < $length) {
            $this->_error(self::TOO_LONG);
        }

        if (count($this->_messages)) {
            return false;
        } else {
            return true;
        }
    }
639065
public function setError($error, $key = null)
	{
		if ($error instanceof Exception)
		{
			$this->error = $error;
			return true;
		}

		return false;
	}
302150
protected function addError($error){

        $this->valid = false;

        if($error instanceof Exception){
            $this->errors[] = array(
                'file' => $error->getFile(),
                'line' => $error->getLine(),
                'message' => "[".get_class($error)."] ".$error->getMessage()
            );
        }elseif($error instanceof LibXMLError){
            $this->errors[] = array(
                'file' => $error->file,
                'line' => $error->line,
                'message' => "[".get_class($error)."] ".$error->message
            );
        }elseif(is_string($error)){
            $this->errors[] = array(
                'message' => $error
            );
        }
    }
90959
public static function assertIsNotInt($variable, Throwable $exception): bool
    {
        static::makeAssertion(!\is_int($variable), $exception);
        return true;
    }
652984
protected function fatalExceptionFromError(array $error, $traceOffset = null)
    {
        return new FatalErrorException(
            $error['message'], $error['type'], 0, $error['file'], $error['line'], $traceOffset
        );
    }
1121395
public static function logException( \Exception $error ) {

		// fatal errors will already have been error_log()'d
		if( !static::isFatal($error) ) {
			$location = $error->getFile(). ':'. $error->getLine();
			// type hinting error - make sure we give the correct location
			if( ($error instanceof \InvalidArgumentException) && ($error->getPrevious() instanceof \ErrorException) )
				$location = $error->getPrevious()->getFile(). ':'. $error->getPrevious()->getLine();
			error_log(get_class($error). ': '. $error->getMessage(). " [{$location}]");
		}

	}
1047729
private function setError($error)
    {
        if (strpos($error, 'ERROR') !== false) {
            if (array_key_exists($error, $this->errors)) {
                throw new Exception($this->errors[$error]);
            } else {
                throw new Exception($error);
            }
        }
    }
608941
public function fatal($error, array $context = array())
    {
        $code = 0;
        if (is_object($error) && is_a($error, 'Exception')) {
            /** @var Exception $error */
            $this->debug(get_class($error) . ' caught in ' . $error->getFile() . ':' . $error->getLine());
            $this->debug($error->getTraceAsString());
            $code = $error->getCode();
            $error = $error->getMessage();

        }
        if (!$code) {
            $code = Exception::E_ANY;
        }

        $this->critical($error, $context);
        exit($code);
    }
297843
static function hasErrorAccrued()
    {
        if (!self::hasHandling())
            return false;

        $stack = self::$_STACK[self::getStackNum()-1];
        return $stack['has_handled_error'];
    }
987500
public static function assertIsNull($variable, Throwable $exception): bool
    {
        static::makeAssertion(null === $variable, $exception);
        return true;
    }