Skip to content

Commit 3e9dade

Browse files
committed
Fixed deprecation warning in PHP 8.5.
1 parent 38d8724 commit 3e9dade

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

.github/workflows/Tests.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ jobs:
2020
- 8.2
2121
- 8.3
2222
- 8.4
23+
- 8.5
2324
dependencies:
2425
- hi
2526
- lo

src/Byte/ByteFormatter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public function format(int|float $bytes, ?int $precision = null): string
5353
$precision === null && $precision = $this->getPrecision();
5454

5555
$log = log($bytes, $this->getBase());
56-
$exponent = $this->hasFixedExponent() ? $this->getFixedExponent() : max(0, (int)$log);
56+
$exponent = $this->hasFixedExponent() ? $this->getFixedExponent() : max(0, $log > -INF ? (int)$log : 0);
5757
$rawValue = $this->getBase() ** ($log - $exponent);
5858
$value = $this->significantFigures ? $this->roundToSignificantFigures($rawValue) : round($rawValue, $precision);
5959
$units = $this->getUnitDecorator()->decorate($exponent, $this->getBase(), $value);

0 commit comments

Comments
 (0)