Correzioni minori per PHP 8

This commit is contained in:
Dasc3er 2020-12-22 15:38:15 +01:00
parent 5767206b3c
commit 8d986d210d
2 changed files with 5 additions and 4 deletions

View File

@ -42,13 +42,13 @@ class SpaceHook extends CachedManager
{ {
$osm_size = $this->getCache()->content; $osm_size = $this->getCache()->content;
$soft_quota = setting('Soft quota'); // Impostazione in GB $soft_quota = (float) setting('Soft quota'); // Impostazione in GB
$space_limit = ($soft_quota / 100) * 95; // 95% dello spazio indicato $space_limit = ($soft_quota / 100) * 95; // 95% dello spazio indicato
$space_limit = $space_limit * 1024 ^ 3; // Trasformazione in GB $space_limit = $space_limit * 1024 ^ 3; // Trasformazione in GB
$message = tr('Attenzione: occupati _TOT_ dei _QUOTA_ previsti', [ $message = tr('Attenzione: occupati _TOT_ dei _QUOTA_ previsti', [
'_TOT_' => FileSystem::formatBytes($osm_size), '_TOT_' => FileSystem::formatBytes($osm_size),
'_QUOTA_' => FileSystem::formatBytes($space_limit), '_QUOTA_' => FileSystem::formatBytes($space_limit),
]); ]);
return [ return [

View File

@ -137,6 +137,7 @@ class Formatter
public function formatNumber($value, $decimals = null) public function formatNumber($value, $decimals = null)
{ {
$value = trim($value); $value = trim($value);
$value = floatval($value);
if (isset($decimals)) { if (isset($decimals)) {
$original = $this->getPrecision(); $original = $this->getPrecision();
@ -144,7 +145,7 @@ class Formatter
} }
if (is_object($this->numberFormatter)) { if (is_object($this->numberFormatter)) {
$result = $this->numberFormatter->format(floatval($value)); $result = $this->numberFormatter->format($value);
} else { } else {
$number = number_format($value, $this->getPrecision(), self::getStandardFormats()['number']['decimals'], self::getStandardFormats()['number']['thousands']); $number = number_format($value, $this->getPrecision(), self::getStandardFormats()['number']['decimals'], self::getStandardFormats()['number']['thousands']);