Skip to content

Commit 7a0d207

Browse files
committed
minor #50297 Remove unnecessary usages of DateTime (nicolas-grekas)
This PR was merged into the 6.4 branch. Discussion ---------- Remove unnecessary usages of DateTime | Q | A | ------------- | --- | Branch? | 6.3 | Bug fix? | no | New feature? | no | Deprecations? | no | Tickets | Part of #47580 | License | MIT | Doc PR | - Together with #50290, this PR removes `DateTime` everywhere possible. What remains is: - test cases that test both DateTime and DateTimeImmutable - legit to keep - date/time form-types and transformers in the Form component - we'd need a separate effort for them, related to #50295 - `PersistentTokenInterface::getLastUsed(): \DateTime` - separate effort also Commits ------- 8b08294b63 Remove unnecessary usages of DateTime
2 parents aacdb39 + ac00bc9 commit 7a0d207

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Tests/InlineTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -574,7 +574,7 @@ public function testParseTimestampAsUnixTimestampByDefault(string $yaml, int $ye
574574
*/
575575
public function testParseTimestampAsDateTimeObject(string $yaml, int $year, int $month, int $day, int $hour, int $minute, int $second, int $microsecond, string $timezone)
576576
{
577-
$expected = (new \DateTime($yaml))
577+
$expected = (new \DateTimeImmutable($yaml))
578578
->setTimeZone(new \DateTimeZone('UTC'))
579579
->setDate($year, $month, $day)
580580
->setTime($hour, $minute, $second, $microsecond);
@@ -599,7 +599,7 @@ public static function getTimestampTests(): array
599599
*/
600600
public function testParseNestedTimestampListAsDateTimeObject(string $yaml, int $year, int $month, int $day, int $hour, int $minute, int $second, int $microsecond)
601601
{
602-
$expected = (new \DateTime($yaml))
602+
$expected = (new \DateTimeImmutable($yaml))
603603
->setTimeZone(new \DateTimeZone('UTC'))
604604
->setDate($year, $month, $day)
605605
->setTime($hour, $minute, $second, $microsecond);

0 commit comments

Comments
 (0)