@@ -523,45 +523,45 @@ public function getTestsForDump()
523523 /**
524524 * @dataProvider getTimestampTests
525525 */
526- public function testParseTimestampAsUnixTimestampByDefault ($ yaml , $ year , $ month , $ day , $ hour , $ minute , $ second )
526+ public function testParseTimestampAsUnixTimestampByDefault (string $ yaml , int $ year , int $ month , int $ day , int $ hour , int $ minute , int $ second )
527527 {
528528 $ this ->assertSame (gmmktime ($ hour , $ minute , $ second , $ month , $ day , $ year ), Inline::parse ($ yaml ));
529529 }
530530
531531 /**
532532 * @dataProvider getTimestampTests
533533 */
534- public function testParseTimestampAsDateTimeObject ($ yaml , $ year , $ month , $ day , $ hour , $ minute , $ second , $ timezone )
534+ public function testParseTimestampAsDateTimeObject (string $ yaml , int $ year , int $ month , int $ day , int $ hour , int $ minute , int $ second , int $ microsecond , string $ timezone )
535535 {
536536 $ expected = new \DateTime ($ yaml );
537537 $ expected ->setTimeZone (new \DateTimeZone ('UTC ' ));
538538 $ expected ->setDate ($ year , $ month , $ day );
539- $ expected ->setTime ($ hour , $ minute , $ second , 1000000 * ( $ second - ( int ) $ second ) );
539+ $ expected ->setTime ($ hour , $ minute , $ second , $ microsecond );
540540
541541 $ date = Inline::parse ($ yaml , Yaml::PARSE_DATETIME );
542542 $ this ->assertEquals ($ expected , $ date );
543543 $ this ->assertSame ($ timezone , $ date ->format ('O ' ));
544544 }
545545
546- public function getTimestampTests ()
546+ public function getTimestampTests (): array
547547 {
548548 return [
549- 'canonical ' => ['2001-12-15T02:59:43.1Z ' , 2001 , 12 , 15 , 2 , 59 , 43.1 , '+0000 ' ],
550- 'ISO-8601 ' => ['2001-12-15t21:59:43.10-05:00 ' , 2001 , 12 , 16 , 2 , 59 , 43.1 , '-0500 ' ],
551- 'spaced ' => ['2001-12-15 21:59:43.10 -5 ' , 2001 , 12 , 16 , 2 , 59 , 43.1 , '-0500 ' ],
552- 'date ' => ['2001-12-15 ' , 2001 , 12 , 15 , 0 , 0 , 0 , '+0000 ' ],
549+ 'canonical ' => ['2001-12-15T02:59:43.1Z ' , 2001 , 12 , 15 , 2 , 59 , 43 , 100000 , '+0000 ' ],
550+ 'ISO-8601 ' => ['2001-12-15t21:59:43.10-05:00 ' , 2001 , 12 , 16 , 2 , 59 , 43 , 100000 , '-0500 ' ],
551+ 'spaced ' => ['2001-12-15 21:59:43.10 -5 ' , 2001 , 12 , 16 , 2 , 59 , 43 , 100000 , '-0500 ' ],
552+ 'date ' => ['2001-12-15 ' , 2001 , 12 , 15 , 0 , 0 , 0 , 0 , '+0000 ' ],
553553 ];
554554 }
555555
556556 /**
557557 * @dataProvider getTimestampTests
558558 */
559- public function testParseNestedTimestampListAsDateTimeObject ($ yaml , $ year , $ month , $ day , $ hour , $ minute , $ second )
559+ public function testParseNestedTimestampListAsDateTimeObject (string $ yaml , int $ year , int $ month , int $ day , int $ hour , int $ minute , int $ second, int $ microsecond )
560560 {
561561 $ expected = new \DateTime ($ yaml );
562562 $ expected ->setTimeZone (new \DateTimeZone ('UTC ' ));
563563 $ expected ->setDate ($ year , $ month , $ day );
564- $ expected ->setTime ($ hour , $ minute , $ second , 1000000 * ( $ second - ( int ) $ second ) );
564+ $ expected ->setTime ($ hour , $ minute , $ second , $ microsecond );
565565
566566 $ expectedNested = ['nested ' => [$ expected ]];
567567 $ yamlNested = "{nested: [ $ yaml]} " ;
0 commit comments