private function getTrace(Throwable $exception): array
    {
        $traces = $exception->getTrace();

        // Get trace from xdebug if enabled, failure exceptions only trace to the shutdown handler by default
        if (! $exception instanceof ErrorException) {
            return $traces;
        }

        if (! self::isLevelFatal($exception->getSeverity())) {
            return $traces;
        }

        if (! \extension_loaded('xdebug') || ! \xdebug_is_enabled()) {
            return [];
        }

        // Use xdebug to get the full stack trace and remove the shutdown handler stack trace
        $stack  = \array_reverse(\xdebug_get_function_stack());
        $trace  = \debug_backtrace(\DEBUG_BACKTRACE_IGNORE_ARGS);

        return \array_diff_key($stack, $trace);
    }
private function getTrace(Throwable $exception): array
    {
        $traces = $exception->getTrace();

        // Get trace from xdebug if enabled, failure exceptions only trace to the shutdown handler by default
        if (! $exception instanceof ErrorException) {
            return $traces;
        }

        if (! self::isLevelFatal($exception->getSeverity())) {
            return $traces;
        }

        if (! \extension_loaded('xdebug') || ! \xdebug_is_enabled()) {
            return [];
        }

        // Use xdebug to get the full stack trace and remove the shutdown handler stack trace
        $stack  = \array_reverse(\xdebug_get_function_stack());
        $trace  = \debug_backtrace(\DEBUG_BACKTRACE_IGNORE_ARGS);

        return \array_diff_key($stack, $trace);
    }
private function getTrace ( Throwable $ exception ) : array { $ traces = $ exception -> getTrace ( ) ; // Get trace from xdebug if enabled, failure exceptions only trace to the shutdown handler by default if ( ! $ exception instanceof ErrorException ) { return $ traces ; } if ( ! self :: isLevelFatal ( $ exception -> getSeverity ( ) ) ) { return $ traces ; } if ( ! \ extension_loaded ( 'xdebug' ) || ! \ xdebug_is_enabled ( ) ) { return [ ] ; } // Use xdebug to get the full stack trace and remove the shutdown handler stack trace $ stack = \ array_reverse ( \ xdebug_get_function_stack ( ) ) ; $ trace = \ debug_backtrace ( \ DEBUG_BACKTRACE_IGNORE_ARGS ) ; return \ array_diff_key ( $ stack , $ trace ) ; }
Gets the backtrace from an exception.

If xdebug is installed

@param \Throwable $exception

@return array
Gets the backtrace from an exception .