| Conditions | 3 |
| Paths | 3 |
| Total Lines | 18 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 17 | public static function getDateTime($value) : DateTimeInterface |
||
| 18 | { |
||
| 19 | $datetime = parent::getDateTime($value); |
||
| 20 | |||
| 21 | if ($datetime instanceof DateTimeImmutable) { |
||
| 22 | return $datetime; |
||
| 23 | } |
||
| 24 | |||
| 25 | if ($datetime instanceof DateTime) { |
||
| 26 | return DateTimeImmutable::createFromMutable($datetime); |
||
| 27 | } |
||
| 28 | |||
| 29 | throw new RuntimeException(sprintf( |
||
| 30 | '%s::getDateTime has returned an unsupported implementation of DateTimeInterface: %s', |
||
| 31 | parent::class, |
||
| 32 | get_class($datetime)) |
||
| 33 | ); |
||
| 34 | } |
||
| 35 | } |
||
| 36 |