diff --git a/src/Illuminate/Support/Number.php b/src/Illuminate/Support/Number.php index 1554ebfd7b55..71d0d51cf85c 100644 --- a/src/Illuminate/Support/Number.php +++ b/src/Illuminate/Support/Number.php @@ -353,7 +353,11 @@ public static function withLocale(string $locale, callable $callback) static::useLocale($locale); - return tap($callback(), fn () => static::useLocale($previousLocale)); + try { + return $callback(); + } finally { + static::useLocale($previousLocale); + } } /** @@ -369,7 +373,11 @@ public static function withCurrency(string $currency, callable $callback) static::useCurrency($currency); - return tap($callback(), fn () => static::useCurrency($previousCurrency)); + try { + return $callback(); + } finally { + static::useCurrency($previousCurrency); + } } /**