@@ -573,10 +573,10 @@ public function testParseTimestampAsUnixTimestampByDefault(string $yaml, int $ye
573
573
*/
574
574
public function testParseTimestampAsDateTimeObject (string $ yaml , int $ year , int $ month , int $ day , int $ hour , int $ minute , int $ second , int $ microsecond , string $ timezone )
575
575
{
576
- $ expected = new \DateTime ($ yaml );
577
- $ expected ->setTimeZone (new \DateTimeZone ('UTC ' ));
578
- $ expected ->setDate ($ year , $ month , $ day );
579
- $ expected ->setTime ($ hour , $ minute , $ second , $ microsecond );
576
+ $ expected = ( new \DateTime ($ yaml ))
577
+ ->setTimeZone (new \DateTimeZone ('UTC ' ))
578
+ ->setDate ($ year , $ month , $ day )
579
+ ->setTime ($ hour , $ minute , $ second , $ microsecond );
580
580
581
581
$ date = Inline::parse ($ yaml , Yaml::PARSE_DATETIME );
582
582
$ this ->assertEquals ($ expected , $ date );
@@ -598,10 +598,10 @@ public function getTimestampTests(): array
598
598
*/
599
599
public function testParseNestedTimestampListAsDateTimeObject (string $ yaml , int $ year , int $ month , int $ day , int $ hour , int $ minute , int $ second , int $ microsecond )
600
600
{
601
- $ expected = new \DateTime ($ yaml );
602
- $ expected ->setTimeZone (new \DateTimeZone ('UTC ' ));
603
- $ expected ->setDate ($ year , $ month , $ day );
604
- $ expected ->setTime ($ hour , $ minute , $ second , $ microsecond );
601
+ $ expected = ( new \DateTime ($ yaml ))
602
+ ->setTimeZone (new \DateTimeZone ('UTC ' ))
603
+ ->setDate ($ year , $ month , $ day )
604
+ ->setTime ($ hour , $ minute , $ second , $ microsecond );
605
605
606
606
$ expectedNested = ['nested ' => [$ expected ]];
607
607
$ yamlNested = "{nested: [ $ yaml]} " ;
@@ -636,7 +636,7 @@ public function getDateTimeDumpTests()
636
636
{
637
637
$ tests = [];
638
638
639
- $ dateTime = new \DateTime ('2001-12-15 21:59:43 ' , new \DateTimeZone ('UTC ' ));
639
+ $ dateTime = new \DateTimeImmutable ('2001-12-15 21:59:43 ' , new \DateTimeZone ('UTC ' ));
640
640
$ tests ['date-time-utc ' ] = [$ dateTime , '2001-12-15T21:59:43+00:00 ' ];
641
641
642
642
$ dateTime = new \DateTimeImmutable ('2001-07-15 21:59:43 ' , new \DateTimeZone ('Europe/Berlin ' ));
0 commit comments