@@ -526,45 +526,45 @@ public function getTestsForDump()
526526 /**
527527 * @dataProvider getTimestampTests
528528 */
529- public function testParseTimestampAsUnixTimestampByDefault ($ yaml , $ year , $ month , $ day , $ hour , $ minute , $ second )
529+ public function testParseTimestampAsUnixTimestampByDefault (string $ yaml , int $ year , int $ month , int $ day , int $ hour , int $ minute , int $ second )
530530 {
531531 $ this ->assertSame (gmmktime ($ hour , $ minute , $ second , $ month , $ day , $ year ), Inline::parse ($ yaml ));
532532 }
533533
534534 /**
535535 * @dataProvider getTimestampTests
536536 */
537- public function testParseTimestampAsDateTimeObject ($ yaml , $ year , $ month , $ day , $ hour , $ minute , $ second , $ timezone )
537+ public function testParseTimestampAsDateTimeObject (string $ yaml , int $ year , int $ month , int $ day , int $ hour , int $ minute , int $ second , int $ microsecond , string $ timezone )
538538 {
539539 $ expected = new \DateTime ($ yaml );
540540 $ expected ->setTimeZone (new \DateTimeZone ('UTC ' ));
541541 $ expected ->setDate ($ year , $ month , $ day );
542- $ expected ->setTime ($ hour , $ minute , $ second , 1000000 * ( $ second - ( int ) $ second ) );
542+ $ expected ->setTime ($ hour , $ minute , $ second , $ microsecond );
543543
544544 $ date = Inline::parse ($ yaml , Yaml::PARSE_DATETIME );
545545 $ this ->assertEquals ($ expected , $ date );
546546 $ this ->assertSame ($ timezone , $ date ->format ('O ' ));
547547 }
548548
549- public function getTimestampTests ()
549+ public function getTimestampTests (): array
550550 {
551551 return [
552- 'canonical ' => ['2001-12-15T02:59:43.1Z ' , 2001 , 12 , 15 , 2 , 59 , 43.1 , '+0000 ' ],
553- 'ISO-8601 ' => ['2001-12-15t21:59:43.10-05:00 ' , 2001 , 12 , 16 , 2 , 59 , 43.1 , '-0500 ' ],
554- 'spaced ' => ['2001-12-15 21:59:43.10 -5 ' , 2001 , 12 , 16 , 2 , 59 , 43.1 , '-0500 ' ],
555- 'date ' => ['2001-12-15 ' , 2001 , 12 , 15 , 0 , 0 , 0 , '+0000 ' ],
552+ 'canonical ' => ['2001-12-15T02:59:43.1Z ' , 2001 , 12 , 15 , 2 , 59 , 43 , 100000 , '+0000 ' ],
553+ 'ISO-8601 ' => ['2001-12-15t21:59:43.10-05:00 ' , 2001 , 12 , 16 , 2 , 59 , 43 , 100000 , '-0500 ' ],
554+ 'spaced ' => ['2001-12-15 21:59:43.10 -5 ' , 2001 , 12 , 16 , 2 , 59 , 43 , 100000 , '-0500 ' ],
555+ 'date ' => ['2001-12-15 ' , 2001 , 12 , 15 , 0 , 0 , 0 , 0 , '+0000 ' ],
556556 ];
557557 }
558558
559559 /**
560560 * @dataProvider getTimestampTests
561561 */
562- public function testParseNestedTimestampListAsDateTimeObject ($ yaml , $ year , $ month , $ day , $ hour , $ minute , $ second )
562+ public function testParseNestedTimestampListAsDateTimeObject (string $ yaml , int $ year , int $ month , int $ day , int $ hour , int $ minute , int $ second, int $ microsecond )
563563 {
564564 $ expected = new \DateTime ($ yaml );
565565 $ expected ->setTimeZone (new \DateTimeZone ('UTC ' ));
566566 $ expected ->setDate ($ year , $ month , $ day );
567- $ expected ->setTime ($ hour , $ minute , $ second , 1000000 * ( $ second - ( int ) $ second ) );
567+ $ expected ->setTime ($ hour , $ minute , $ second , $ microsecond );
568568
569569 $ expectedNested = ['nested ' => [$ expected ]];
570570 $ yamlNested = "{nested: [ $ yaml]} " ;
0 commit comments