Skip to content
This repository has been archived by the owner on Nov 19, 2023. It is now read-only.

Commit

Permalink
Use callable type hint for $block argument to Assert::throws()
Browse files Browse the repository at this point in the history
  • Loading branch information
thekid committed Sep 20, 2020
1 parent 98683b3 commit 734978e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/main/php/unittest/Assert.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,13 +96,13 @@ public static function instance($type, $actual, $error= 'instanceof') {
* Assert that a given exception is raised
*
* @param string|lang.Type $type
* @param callable $func
* @param callable $block
* @return void
*/
public static function throws($type, $func) {
public static function throws($type, callable $block) {
$t= $type instanceof Type ? $type : Type::forName($type);
try {
$func();
$block();
} catch (\Throwable $expected) {
if ($t->isInstance($expected)) return;

Expand Down

0 comments on commit 734978e

Please sign in to comment.