mirror of
https://github.com/filp/whoops.git
synced 2026-09-15 12:16:18 +00:00
- move isLevelFatal method to public method to utility class to be utilized by other classes
- add some basic documentation to isLevelFatal method
This commit is contained in:
+2
-12
@@ -13,6 +13,7 @@ use Whoops\Exception\Inspector;
|
||||
use Whoops\Handler\CallbackHandler;
|
||||
use Whoops\Handler\Handler;
|
||||
use Whoops\Handler\HandlerInterface;
|
||||
use Whoops\Util\Misc;
|
||||
|
||||
class Run
|
||||
{
|
||||
@@ -346,7 +347,7 @@ class Run
|
||||
$this->canThrowExceptions = false;
|
||||
|
||||
$error = error_get_last();
|
||||
if ($error && $this->isLevelFatal($error['type'])) {
|
||||
if ($error && Misc::isLevelFatal($error['type'])) {
|
||||
// If there was a fatal error,
|
||||
// it was not handled in handleError yet.
|
||||
$this->handleError(
|
||||
@@ -394,15 +395,4 @@ class Run
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
private static function isLevelFatal($level)
|
||||
{
|
||||
$errors = E_ERROR;
|
||||
$errors |= E_PARSE;
|
||||
$errors |= E_CORE_ERROR;
|
||||
$errors |= E_CORE_WARNING;
|
||||
$errors |= E_COMPILE_ERROR;
|
||||
$errors |= E_COMPILE_WARNING;
|
||||
return ($level & $errors) > 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,4 +41,21 @@ class Misc
|
||||
}
|
||||
return "E_UNKNOWN";
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if an error level is fatal (halts execution)
|
||||
*
|
||||
* @param int $level
|
||||
* @return boolean
|
||||
*/
|
||||
public static function isLevelFatal($level)
|
||||
{
|
||||
$errors = E_ERROR;
|
||||
$errors |= E_PARSE;
|
||||
$errors |= E_CORE_ERROR;
|
||||
$errors |= E_CORE_WARNING;
|
||||
$errors |= E_COMPILE_ERROR;
|
||||
$errors |= E_COMPILE_WARNING;
|
||||
return ($level & $errors) > 0;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user