@@ -208,6 +208,7 @@ public function testConstructorWithoutArgs(): void
208208 #[TestWith([100.999_99 , 101 ])]
209209 #[TestWith([PHP_INT_MAX , PHP_INT_MAX ])]
210210 #[TestWith([PHP_INT_MIN , PHP_INT_MIN ])]
211+ #[TestWith([PHP_INT_MIN - 1_024 , PHP_INT_MIN ])]
211212 #[TestWith([9_223_372_036_854_775_000.0 , 9_223_372_036_854_774_784 ])]
212213 #[TestWith([-9_223_372_036_854_775_000.0 , -9_223_372_036_854_774_784 ])]
213214 public function testFromNanoseconds (int |float $ nanoseconds , int $ expected ): void
@@ -322,6 +323,8 @@ public function testFromDaysPHPSince84(float $days, int $expected): void
322323 #[TestWith([106_751.991_2 ])]
323324 #[TestWith([-106_752 ])]
324325 #[TestWith([-106_751.991_2 ])]
326+ #[TestWith([NAN ])]
327+ #[TestWith([INF ])]
325328 public function testFromDaysThrowsOutOfBounds (int |float $ days ): void
326329 {
327330 $ this ->expectException (\OutOfBoundsException::class);
@@ -330,6 +333,16 @@ public function testFromDaysThrowsOutOfBounds(int|float $days): void
330333 TimeSpan::fromDays ($ days );
331334 }
332335
336+ #[TestWith([PHP_INT_MAX + 1 ])]
337+ #[TestWith([PHP_INT_MIN - 1_025 ])]
338+ public function testFromNanosecondsThrowsOutOfBounds (float $ nanoseconds ): void
339+ {
340+ $ this ->expectException (\OutOfBoundsException::class);
341+ $ this ->expectExceptionMessage ('The specified time span cannot be expressed as integer nanoseconds due to overflow. ' );
342+
343+ TimeSpan::fromNanoseconds ($ nanoseconds );
344+ }
345+
333346 #[TestWith([100_000 , 100.0 , 100 ])]
334347 #[TestWith([100_100 , 100.1 , 100 ])]
335348 #[TestWith([100_500 , 100.5 , 101 ])]
0 commit comments