Errors in PHP 7 - why set_error_handler() can't catch this type of error?

305 Views Asked by At

Fatal error: Uncaught TypeError...

Why is this an exception according to PHP if TypeError inherits from Error? Why can't set_error_handler() catch this type of error?

https://www.php.net/manual/en/class.typeerror.php

function myFunction(int $parameter)
{
    return $parameter;
}
function handler($errno, $errstr, $errfile, $errline)
{
    echo 'handler';
}
set_error_handler("handler");
myFunction('george');
0

There are 0 best solutions below