<?php

function error_handler( $errno, $errstr, $errfile = '', $errline = '' ) {
    $stuff = true;
};
set_error_handler('error_handler');

Class Test
{
    public function a()
    {
        $a = 10;
        trigger_error('aaaaa', E_USER_NOTICE);
    }
}

$t = new Test;
$t->a();