mirror of
https://github.com/HDInnovations/UNIT3D.git
synced 2026-01-31 01:35:31 +01:00
fix: cast floor to int to ensure int return type
There are no valid cases in the contexts where this function is used where the float will be greater than the range of the int (which is why the `min` functionr returns `mixed`)
This commit is contained in:
@@ -103,7 +103,7 @@ class SystemInformation
|
||||
protected function formatBytes(int|float $bytes, int $precision = 2): string
|
||||
{
|
||||
$bytes = max($bytes, 0);
|
||||
$pow = floor(($bytes ? log($bytes) : 0) / log(1_024));
|
||||
$pow = (int) floor(($bytes ? log($bytes) : 0) / log(1_024));
|
||||
$pow = min($pow, (\count(self::UNITS)) - 1);
|
||||
// Uncomment one of the following alternatives
|
||||
$bytes /= 1_024 ** $pow;
|
||||
|
||||
@@ -210,12 +210,6 @@ parameters:
|
||||
count: 1
|
||||
path: app/Helpers/CacheUser.php
|
||||
|
||||
-
|
||||
message: '#^Possibly invalid array key type float\|int\.$#'
|
||||
identifier: offsetAccess.invalidOffset
|
||||
count: 1
|
||||
path: app/Helpers/SystemInformation.php
|
||||
|
||||
-
|
||||
message: '#^Method App\\Http\\Controllers\\API\\BaseController\:\:sendError\(\) has parameter \$code with no type specified\.$#'
|
||||
identifier: missingType.parameter
|
||||
|
||||
Reference in New Issue
Block a user