phpstan-exception-rules icon indicating copy to clipboard operation
phpstan-exception-rules copied to clipboard

random_int and random_bytes exceptions

Open kick-the-bucket opened this issue 5 years ago • 0 comments

Both random_int and random_bytes internal functions throw Exception (among others), but if you try catching it - you get an error Exception is never thrown in the corresponding try block.

Code to reproduce:

try {
    random_int(0, PHP_INT_MAX);
catch (Exception) {
}

kick-the-bucket avatar Jan 19 '21 16:01 kick-the-bucket