exception for callable in phpstan

60 views Asked by At

how can I describe the exceptions thrown from callable in phpDoc? For example I have:

/**
 * @param callable(int): bool
 */
function (callable $foo, int $number): ?bool
{
    try {
        return $foo($number);
    } catch (InvalidNumberException) {
        return null;
    }
}

And I want something like this:

/**
 * @param callable(int): bool throws InvalidNumberException
 */
function (callable $foo, int $number): ?bool
{
    try {
        return $foo($number);
    } catch (InvalidNumberException) {
        return null;
    }
}
0

There are 0 answers