Skip to content

Commit 870dad4

Browse files
committed
🐛 ensure $when->minute is cast to int for Carbon::setDateTime
Added explicit `(int)` cast to fix a `TypeError` caused by `floor()` returning a float. This resolves the issue where Carbon's `setDateTime()` expects `$minute` as an int.
1 parent 3332547 commit 870dad4

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

app/DataProviders/CachedHafas.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public function getDepartures(Station $station, Carbon $when, int $duration = 15
4545
$when = clone $when;
4646
$when->subMinutes(2);
4747
// set cache when minutes to 0, 15, 30 or 45
48-
$when->minute = floor($when->minute / 15) * 15;
48+
$when->minute = (int) (floor($when->minute / 15) * 15);
4949
$when->second = 0;
5050

5151
// set duration longer than 15 minutes

0 commit comments

Comments
 (0)