diff --git a/src/functions.php b/src/functions.php index 2fe36af5..d3b34e19 100644 --- a/src/functions.php +++ b/src/functions.php @@ -463,7 +463,7 @@ function laravel_or_fail($app, ?string $caller = null): Application } if (\is_null($caller)) { - $caller = transform(debug_backtrace()[1], function ($debug) { + $caller = transform(debug_backtrace()[1] ?? [], function ($debug) { if (isset($debug['class']) && isset($debug['function'])) { return \sprintf('%s::%s', $debug['class'], $debug['function']); } @@ -472,5 +472,5 @@ function laravel_or_fail($app, ?string $caller = null): Application }); } - throw Exceptions\ApplicationNotAvailableException::make($caller ?? debug_backtrace()[1]['function']); + throw Exceptions\ApplicationNotAvailableException::make($caller); }