From 37e2d89478a9929ddb1810643c992417512510cc Mon Sep 17 00:00:00 2001 From: AFS Date: Sat, 1 Feb 2025 11:05:10 +0100 Subject: [PATCH] Fix Carbon\Carbon::rawAddUnit() string error Carbon::add call expects a float or int for value but string was provided in ProjectionCollection getAllPeriods. Fixed by casting $periodQuantity to float. --- src/Collections/ProjectionCollection.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Collections/ProjectionCollection.php b/src/Collections/ProjectionCollection.php index ca8b4f9..4eade7f 100644 --- a/src/Collections/ProjectionCollection.php +++ b/src/Collections/ProjectionCollection.php @@ -196,7 +196,7 @@ private function getAllPeriods(Carbon $startDate, Carbon $endDate, string $perio [$periodQuantity, $periodType] = Str::of($period)->split('/[\s]+/'); while ($cursorDate->notEqualTo($endDate)): - $cursorDate->add($periodQuantity, $periodType); + $cursorDate->add((float)$periodQuantity, $periodType); if ($cursorDate->notEqualTo($endDate)) { $allProjectionsDates->push(clone $cursorDate);