@@ -502,22 +502,18 @@ public function testCastDateTime(): void
502502
503503 public function testCastDateTimeWithTimestampTimezone (): void
504504 {
505- // Save the current timezone.
506505 $ tz = date_default_timezone_get ();
507-
508- // Change the timezone other than UTC.
509- date_default_timezone_set ('Asia/Tokyo ' ); // +09:00
506+ date_default_timezone_set ('Asia/Tokyo ' );
510507
511508 $ entity = $ this ->getCastEntity ();
512509
513510 $ entity ->eighth = 1722988800 ; // 2024-08-07 00:00:00 UTC
514511
515- $ this ->assertInstanceOf (DateTimeInterface ::class, $ entity ->eighth );
512+ $ this ->assertInstanceOf (Time ::class, $ entity ->eighth );
516513 // The timezone is the default timezone, not UTC.
517514 $ this ->assertSame ('2024-08-07 09:00:00 ' , $ entity ->eighth ->format ('Y-m-d H:i:s ' ));
518515 $ this ->assertSame ('Asia/Tokyo ' , $ entity ->eighth ->getTimezoneName ());
519516
520- // Restore timezone.
521517 date_default_timezone_set ($ tz );
522518 }
523519
@@ -651,8 +647,8 @@ public function testCastAsJSON(): void
651647 $ check = $ this ->getPrivateProperty ($ entity , 'attributes ' )['tenth ' ];
652648 $ this ->assertSame ('{"foo":"bar"} ' , $ check );
653649
654- $ this ->assertInstanceOf (' stdClass ' , $ entity ->tenth );
655- $ this ->assertSame ([ ' foo ' => ' bar '], ( array ) $ entity ->tenth );
650+ $ this ->assertInstanceOf (stdClass::class , $ entity ->tenth );
651+ $ this ->assertSame (' bar ', $ entity ->tenth -> foo );
656652 }
657653
658654 public function testCastAsJSONArray (): void
@@ -1744,7 +1740,10 @@ private function getSimpleSwappedEntity(): object
17441740 };
17451741 }
17461742
1747- private function getCastEntity ($ data = null ): object
1743+ /**
1744+ * @param array<string, mixed>|null $data
1745+ */
1746+ private function getCastEntity (?array $ data = null ): Entity
17481747 {
17491748 return new class ($ data ) extends Entity {
17501749 protected $ attributes = [
0 commit comments