1717use App \Entity \User ;
1818use Doctrine \Bundle \FixturesBundle \Fixture ;
1919use Doctrine \Persistence \ObjectManager ;
20+ use Symfony \Component \Clock \DatePoint ;
2021use Symfony \Component \PasswordHasher \Hasher \UserPasswordHasherInterface ;
2122use Symfony \Component \String \AbstractUnicodeString ;
2223use Symfony \Component \String \Slugger \SluggerInterface ;
@@ -85,7 +86,7 @@ private function loadPosts(ObjectManager $manager): void
8586 $ comment = new Comment ();
8687 $ comment ->setAuthor ($ this ->getReference ('john_user ' , User::class));
8788 $ comment ->setContent ($ this ->getRandomText (random_int (255 , 512 )));
88- $ comment ->setPublishedAt (new \ DateTimeImmutable ('now + ' .$ i .'seconds ' ));
89+ $ comment ->setPublishedAt (new DatePoint ('now + ' .$ i .'seconds ' ));
8990
9091 $ post ->addComment ($ comment );
9192 }
@@ -128,7 +129,7 @@ private function getTagData(): array
128129 }
129130
130131 /**
131- * @return array<int, array{0: string, 1: AbstractUnicodeString, 2: string, 3: string, 4: \DateTimeImmutable , 5: User, 6: array<Tag>}>
132+ * @return array<int, array{0: string, 1: AbstractUnicodeString, 2: string, 3: string, 4: DatePoint , 5: User, 6: array<Tag>}>
132133 *
133134 * @throws \Exception
134135 */
@@ -143,7 +144,7 @@ private function getPostData(): array
143144 $ this ->slugger ->slug ($ title )->lower (),
144145 $ this ->getRandomText (),
145146 $ this ->getPostContent (),
146- (new \ DateTimeImmutable ('now - ' .$ i .'days ' ))->setTime (random_int (8 , 17 ), random_int (7 , 49 ), random_int (0 , 59 )),
147+ (new DatePoint ('now - ' .$ i .'days ' ))->setTime (random_int (8 , 17 ), random_int (7 , 49 ), random_int (0 , 59 )),
147148 // Ensure that the first post is written by Jane Doe to simplify tests
148149 $ this ->getReference (['jane_admin ' , 'tom_admin ' ][0 === $ i ? 0 : random_int (0 , 1 )], User::class),
149150 $ this ->getRandomTags (),
0 commit comments