class ClassA {
public function method_a (ClassB $b) {
echo '<br>'.'method'.'<br>';
}
}
class Wrong{}
$a = new ClassA;
$a->method_a(new Wrong);
echo 'done.';
Catchable fatal error: Argument 1 passed to ClassA::method_a() must be an instance of ClassB, instance of Wrong given
Но если я добавлю
function myErrorHandler($errno, $errstr, $errfile, $errline) {
if ( E_RECOVERABLE_ERROR===$errno ) {
echo "'catched' catchable fatal error\n";
return true;
}
return false;
}
set_error_handler('myErrorHandler');
Ошибка пропадает и (важно!) идет вызов метода!Почему идет вызов метода?