Bug report
Signature for set_error_handler is different when analysis is run under PHP 8, and it doesn't recognize the return value as a callable, but as a union to all the possible callable types, which is too wide.
[EDIT] Same for set_exception_handler
This is possibly related to #4203, since the root cause seems to be the same: PHPStan is reading signatures from core under PHP 8, but those are still not precise enough.
Code snippet that reproduces the problem
https://phpstan.org/r/7cc7d34c-4ca1-4cce-9022-06be9c0036f8
https://phpstan.org/r/bc2cb1b3-0564-4a9b-b1b4-b9291c0719a9
Expected output
No errors as if it was run under 7.x