How to catch the "Call to undefined method" error in PHP 7?
<p>I use my own simple error handling and can actually catch&amp;log everything I need. But now I need to catch an error with <code>try{}catch(){}</code>. The error, that I expect occurring sometimes at that place, is the "Call to undefined method" error. I can catch it like this:</p>

<pre><code>try {
    $someObject-&gt;someMethodTheObjectDoesntProvide();
} catch (Error $e) {
    // do something else
}
</code></pre>

<p>But the <code>Error</code> class in the <code>catch</code> clause is a bit to generic. I'd like to catch only this type of error.</p>

<p><strong>Is there a way to restrict the catching to a particular "type" of errors?</strong></p>

<p><sub>Without using <code>strpos($errorMessage)</code>... ;)</sub></p>