public static function handleError($errno, $errstr, $errfile, $errline)
{
if (!($errno & error_reporting())) {
return FALSE;
}
self::$errorStack[] = array($errno, $errstr, $errfile, $errline);
$trace = debug_backtrace(FALSE);
array_shift($trace);
foreach ($trace as $frame) {
if ($frame['function'] == '__toString') {
return FALSE;
}
}
if ($errno == E_NOTICE || $errno == E_USER_NOTICE || $errno == E_STRICT) {
if (PHPUnit_Framework_Error_Notice::$enabled !== TRUE) {
return FALSE;
}
$exception = 'PHPUnit_Framework_Error_Notice';
} else {
if ($errno == E_WARNING || $errno == E_USER_WARNING) {
if (PHPUnit_Framework_Error_Warning::$enabled !== TRUE) {
return FALSE;
}
$exception = 'PHPUnit_Framework_Error_Warning';
} else {
$exception = 'PHPUnit_Framework_Error';
}
}
throw new $exception($errstr, $errno, $errfile, $errline, $trace);
}