public function getBacktraceFromException($e) {
		$trace = $e->getTrace();

		if($e instanceof FatalErrorException) {
			#Credit to Symfony
			if(function_exists('xdebug_get_function_stack')) {
				$trace = array_slice(array_reverse(xdebug_get_function_stack()), 4);
				foreach($trace as $i => $frame) {
					if(!isset($frame['type']))
						$trace[$i]['type'] = '?';
					elseif($trace[$i]['type'] === 'dynamic')
						$trace[$i]['type'] = '->';
					elseif($trace[$i]['type'] === 'static')
						$trace[$i]['type'] = '::';

					if(isset($frame['params']) && !isset($frame['args'])) {
						$trace[$i]['args'] = $frame['params'];
						unset($trace[$i]['params']);
					}
				}
				$lastStep = [
					'line' => $e->getLine(),
					'file' => $e->getFile(),
				];
				array_unshift($trace, $lastStep);
			}
			else {
				$trace = [[
					'line' => $e->getLine(),
					'file' => $e->getFile(),
				]];
			}
		}
		elseif($e instanceof \Throwable) {
			array_unshift($trace, [
				'file' => $e->getFile(),
				'line' => $e->getLine(),
				'function' => null,
				'class' => null,
				'type' => null,
				'args' => [],
			]);
		}

		return $trace;
	}
public function getBacktraceFromException($e) {
		$trace = $e->getTrace();

		if($e instanceof FatalErrorException) {
			#Credit to Symfony
			if(function_exists('xdebug_get_function_stack')) {
				$trace = array_slice(array_reverse(xdebug_get_function_stack()), 4);
				foreach($trace as $i => $frame) {
					if(!isset($frame['type']))
						$trace[$i]['type'] = '?';
					elseif($trace[$i]['type'] === 'dynamic')
						$trace[$i]['type'] = '->';
					elseif($trace[$i]['type'] === 'static')
						$trace[$i]['type'] = '::';

					if(isset($frame['params']) && !isset($frame['args'])) {
						$trace[$i]['args'] = $frame['params'];
						unset($trace[$i]['params']);
					}
				}
				$lastStep = [
					'line' => $e->getLine(),
					'file' => $e->getFile(),
				];
				array_unshift($trace, $lastStep);
			}
			else {
				$trace = [[
					'line' => $e->getLine(),
					'file' => $e->getFile(),
				]];
			}
		}
		elseif($e instanceof \Throwable) {
			array_unshift($trace, [
				'file' => $e->getFile(),
				'line' => $e->getLine(),
				'function' => null,
				'class' => null,
				'type' => null,
				'args' => [],
			]);
		}

		return $trace;
	}
public function getBacktraceFromException ( $ e ) { $ trace = $ e -> getTrace ( ) ; if ( $ e instanceof FatalErrorException ) { #Credit to Symfony if ( function_exists ( 'xdebug_get_function_stack' ) ) { $ trace = array_slice ( array_reverse ( xdebug_get_function_stack ( ) ) , 4 ) ; foreach ( $ trace as $ i => $ frame ) { if ( ! isset ( $ frame [ 'type' ] ) ) $ trace [ $ i ] [ 'type' ] = '?' ; elseif ( $ trace [ $ i ] [ 'type' ] === 'dynamic' ) $ trace [ $ i ] [ 'type' ] = '->' ; elseif ( $ trace [ $ i ] [ 'type' ] === 'static' ) $ trace [ $ i ] [ 'type' ] = '::' ; if ( isset ( $ frame [ 'params' ] ) && ! isset ( $ frame [ 'args' ] ) ) { $ trace [ $ i ] [ 'args' ] = $ frame [ 'params' ] ; unset ( $ trace [ $ i ] [ 'params' ] ) ; } } $ lastStep = [ 'line' => $ e -> getLine ( ) , 'file' => $ e -> getFile ( ) , ] ; array_unshift ( $ trace , $ lastStep ) ; } else { $ trace = [ [ 'line' => $ e -> getLine ( ) , 'file' => $ e -> getFile ( ) , ] ] ; } } elseif ( $ e instanceof \ Throwable ) { array_unshift ( $ trace , [ 'file' => $ e -> getFile ( ) , 'line' => $ e -> getLine ( ) , 'function' => null , 'class' => null , 'type' => null , 'args' => [ ] , ] ) ; } return $ trace ; }
Return backtrace from an exception.
@param  \Exception|\Throwable $e
@return array
Return backtrace from an exception .