fix php 8.1 deprecations (#3648)

* show session maxlifetime in doctor
* rephrase compatibility in release notes
* bump version
This commit is contained in:
Kevin Papst
2022-11-24 13:12:18 +01:00
committed by GitHub
parent 2aa5eccc7c
commit 94a6b99c57
20 changed files with 125 additions and 57 deletions

View File

@@ -45,33 +45,45 @@ final class LocaleHelper
/**
* Transforms seconds into a decimal formatted duration string.
*
* @param int $seconds
* @param int|null $seconds
* @return string
*/
public function durationDecimal(int $seconds)
public function durationDecimal(?int $seconds): string
{
if ($seconds === null) {
$seconds = 0;
}
$value = round($seconds / 3600, 2);
return $this->getDurationFormatter()->format((float) $value);
return $this->getDurationFormatter()->format($value);
}
/**
* Only used in twig filter |amount and invoice templates
*
* @param string|float $amount
* @param string|float|null $amount
* @return bool|false|string
*/
public function amount($amount)
{
if ($amount === null) {
$amount = 0.00;
}
return $this->getNumberFormatter()->format($amount);
}
/**
* @param string $currency
* @param string|null $currency
* @return string
*/
public function currency($currency)
public function currency(?string $currency)
{
if ($currency === null) {
return '';
}
try {
return Currencies::getSymbol(strtoupper($currency), $this->locale);
} catch (\Exception $ex) {
@@ -109,7 +121,7 @@ final class LocaleHelper
}
/**
* @param int|float $amount
* @param int|float|null $amount
* @param string|null $currency
* @param bool $withCurrency
* @return string
@@ -120,6 +132,10 @@ final class LocaleHelper
$withCurrency = false;
}
if ($amount === null) {
$amount = 0;
}
if (false === $withCurrency) {
return $this->getMoneyFormatter($withCurrency)->format($amount, NumberFormatter::TYPE_DEFAULT);
}