Completed
Pull Request — master (#2118)
by Maciej
19:12
created

DateImmutableType::getDateTime()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 6
ccs 3
cts 3
cp 1
rs 10
c 0
b 0
f 0
cc 2
nc 2
nop 1
crap 2
1
<?php
2
3
namespace Doctrine\ODM\MongoDB\Types;
4
5
use DateTime;
6
use DateTimeImmutable;
7
use DateTimeInterface;
8
9
class DateImmutableType extends DateType
10
{
11 19
    public static function getDateTime($value): DateTimeInterface
12
    {
13 19
        $datetime = parent::getDateTime($value);
14
15 14
        return $datetime instanceof DateTime ? DateTimeImmutable::createFromMutable($datetime) : $datetime;
16
    }
17
}
18