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 given

But if I add

 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'); 

The error disappears and ( important! ) The method call goes! Why the method call goes?

    1 answer 1

    Well, the bypass error goes, just return false to write to the handler, or do a throw exception