Skip to content

Commit d533c15

Browse files
authored
Merge pull request #9 from J0sh0nat0r/fix/as-date-time-return-type
fix: allow returning any `CarbonInterface` from `asDateTime`
2 parents 3f8ce6c + 91caf42 commit d533c15

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Concerns/HasCasts.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -344,15 +344,15 @@ protected function asTimestamp(mixed $value): int
344344
/**
345345
* Return a timestamp as DateTime object with time set to 00:00:00.
346346
*/
347-
protected function asDate(mixed $value): Carbon
347+
protected function asDate(mixed $value): CarbonInterface
348348
{
349349
return $this->asDateTime($value)->startOfDay();
350350
}
351351

352352
/**
353353
* Return a timestamp as DateTime object.
354354
*/
355-
protected function asDateTime(mixed $value): Carbon
355+
protected function asDateTime(mixed $value): CarbonInterface
356356
{
357357
if ($value instanceof CarbonInterface) {
358358
return Date::instance($value);

0 commit comments

Comments
 (0)