in src/ExpectObj.hack [526:552]
public function notToThrow(
?string $msg = null,
mixed ...$args
): void where T as (function(): mixed) {
$msg = \vsprintf($msg, $args);
$e = $this->tryCallReturnException(\Exception::class);
if ($e !== null) {
$msg = Str\format(
"%s was thrown: %s\n%s",
\get_class($e),
$msg,
Vec\map(
$e->getTrace(),
$t ==> {
$t = $t as KeyedContainer<_, _>;
return Str\format(
'%s: %d',
idx($t, 'file') as ?string ?? '<no file>',
idx($t, 'line') as ?int ?? -1,
);
},
)
|> Str\join($$, "\n "),
);
}
$this->assertNull($e, $msg);
}