From c1b80fe268c24d8815df03305dde6bcf0c3fda23 Mon Sep 17 00:00:00 2001 From: Mathieu Ducrot Date: Wed, 29 May 2024 11:08:18 +0200 Subject: [PATCH] DateUtils::millisecondsToString int type cast when calling secondsToString to fix the deprecated: Implicit conversion from float --- CHANGELOG.md | 5 +++++ src/Utils/DateUtils.php | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 13d0378..1b57780 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,11 @@ CHANGELOG for 1.x =================== +## v1.4.1 - (2024-05-29) +### Fixed +- `DateUtils::millisecondsToString` int type cast when calling **secondsToString** to fix the deprecated: Implicit conversion from float + ## v1.4.0 - (2024-05-06) +### Added - `PhpFormatter` common date formatting to use on DateTime::format https://www.php.net/manual/en/datetime.format.php ## v1.3.0 - (2024-04-29) diff --git a/src/Utils/DateUtils.php b/src/Utils/DateUtils.php index 3b5cb96..feea423 100644 --- a/src/Utils/DateUtils.php +++ b/src/Utils/DateUtils.php @@ -586,7 +586,7 @@ public static function millisecondsToString(?int $value): ?string if ($value === null) { return null; } - $toReturn = self::secondsToString($value / 1000); // We reduce it to the seconds to benefit from secondsToString + $toReturn = self::secondsToString((int) ($value / 1000)); // We reduce it to the seconds to benefit from secondsToString if ($value > 60000) { // We act that printing the number of ms is only relevant if the $value is under a minute. return $toReturn; } elseif ($value < 1000) { // If inferior to 1 second we remove the '0s'