4343
4444function testThrowIf (float |int $ foo , ?DateTime $ bar = null ): void
4545{
46- assertType ('never ' , throw_if (true , Exception::class));
46+ rescue ( fn () => assertType ('never ' , throw_if (true , Exception::class) ));
4747 assertType ('false ' , throw_if (false , Exception::class));
4848 assertType ('false ' , throw_if (empty ($ foo )));
4949 throw_if (is_float ($ foo ));
@@ -56,13 +56,13 @@ function testThrowIf(float|int $foo, ?DateTime $bar = null): void
5656 assertType ('null ' , $ bar );
5757 assertType ('null ' , throw_if (null , Exception::class));
5858 assertType ("'' " , throw_if ('' , Exception::class));
59- assertType ('never ' , throw_if ('foo ' , Exception::class));
59+ rescue ( fn () => assertType ('never ' , throw_if ('foo ' , Exception::class) ));
6060}
6161
6262function testThrowUnless (float |int $ foo , ?DateTime $ bar = null ): void
6363{
6464 assertType ('true ' , throw_unless (true , Exception::class));
65- assertType ('never ' , throw_unless (false , Exception::class));
65+ rescue ( fn () => assertType ('never ' , throw_unless (false , Exception::class) ));
6666 assertType ('true ' , throw_unless (empty ($ foo )));
6767 throw_unless (is_int ($ foo ));
6868 assertType ('int ' , $ foo );
@@ -72,8 +72,8 @@ function testThrowUnless(float|int $foo, ?DateTime $bar = null): void
7272 assertType ('DateTime ' , $ bar );
7373
7474 // Truthy/falsey argument
75- assertType ('never ' , throw_unless (null , Exception::class));
76- assertType ('never ' , throw_unless ('' , Exception::class));
75+ rescue ( fn () => assertType ('never ' , throw_unless (null , Exception::class) ));
76+ rescue ( fn () => assertType ('never ' , throw_unless ('' , Exception::class) ));
7777 assertType ("'foo' " , throw_unless ('foo ' , Exception::class));
7878}
7979
0 commit comments