diff --git a/src/ChronosDate.php b/src/ChronosDate.php index a9f1ce5..0ee11ac 100644 --- a/src/ChronosDate.php +++ b/src/ChronosDate.php @@ -1564,11 +1564,11 @@ public function diffForHumans(?ChronosDate $other = null, bool $absolute = false } /** - * Returns the date as a DateTimeImmutable instance. + * Returns the date as a `DateTimeImmutable` instance. * * @return \DateTimeImmutable */ - public function toNative(): DateTimeImmutable + public function toDateTimeImmutable(): DateTimeImmutable { return $this->native; } diff --git a/src/ChronosTime.php b/src/ChronosTime.php index 46fb795..1414ca0 100644 --- a/src/ChronosTime.php +++ b/src/ChronosTime.php @@ -320,7 +320,7 @@ protected static function mod(int $a, int $b): int */ public function format(string $format): string { - return $this->toNative()->format($format); + return $this->toDateTimeImmutable()->format($format); } /** @@ -404,7 +404,7 @@ public function between(ChronosTime $start, ChronosTime $end, bool $equals = tru * * @return \DateTimeImmutable */ - public function toNative(): DateTimeImmutable + public function toDateTimeImmutable(): DateTimeImmutable { return (new DateTimeImmutable())->setTime( $this->getHours(), diff --git a/tests/TestCase/ChronosTimeTest.php b/tests/TestCase/ChronosTimeTest.php index 3a91044..f5d184e 100644 --- a/tests/TestCase/ChronosTimeTest.php +++ b/tests/TestCase/ChronosTimeTest.php @@ -260,9 +260,9 @@ public function testComparisons(): void $this->assertFalse($t3->between($t1, $t2)); } - public function testToNative(): void + public function testToDateTimeImmutable(): void { - $native = ChronosTime::parse('23:59:59.999999')->toNative(); + $native = ChronosTime::parse('23:59:59.999999')->toDateTimeImmutable(); $this->assertSame('23:59:59.999999', $native->format('H:i:s.u')); } } diff --git a/tests/TestCase/Date/StringsTest.php b/tests/TestCase/Date/StringsTest.php index 7f004bb..97cbc5a 100644 --- a/tests/TestCase/Date/StringsTest.php +++ b/tests/TestCase/Date/StringsTest.php @@ -173,9 +173,9 @@ public function testToW3cString() $this->assertSame('1975-12-25T00:00:00+00:00', $d->toW3cString()); } - public function testToNative(): void + public function testToDateTimeImmutable(): void { $d = ChronosDate::now(); - $this->assertSame($d->format('Y-m-d'), $d->toNative()->format('Y-m-d')); + $this->assertSame($d->format('Y-m-d'), $d->toDateTimeImmutable()->format('Y-m-d')); } }