diff --git a/src/Symfony/Component/Debug/ErrorHandler.php b/src/Symfony/Component/Debug/ErrorHandler.php index d043aa5ec1..8afa49ee64 100644 --- a/src/Symfony/Component/Debug/ErrorHandler.php +++ b/src/Symfony/Component/Debug/ErrorHandler.php @@ -16,6 +16,7 @@ use Symfony\Component\Debug\Exception\ContextErrorException; use Symfony\Component\Debug\Exception\FatalErrorException; use Symfony\Component\Debug\FatalErrorHandler\UndefinedFunctionFatalErrorHandler; use Symfony\Component\Debug\FatalErrorHandler\ClassNotFoundFatalErrorHandler; +use Symfony\Component\Debug\FatalErrorHandler\FatalErrorHandlerInterface; /** * ErrorHandler. @@ -57,7 +58,7 @@ class ErrorHandler /** * Registers the error handler. * - * @param integer $level The level at which the conversion to Exception is done (null to use the error_reporting() value and 0 to disable) + * @param integer $level The level at which the conversion to Exception is done (null to use the error_reporting() value and 0 to disable) * @param Boolean $displayErrors Display errors (for dev environment) or just log they (production usage) * * @return The registered error handler @@ -76,16 +77,32 @@ class ErrorHandler return $handler; } + /** + * Sets the level at which the conversion to Exception is done. + * + * @param integer|null $level The level (null to use the error_reporting() value and 0 to disable) + */ public function setLevel($level) { $this->level = null === $level ? error_reporting() : $level; } + /** + * Sets the display_errors flag value. + * + * @param integer $displayErrors The display_errors flag value + */ public function setDisplayErrors($displayErrors) { $this->displayErrors = $displayErrors; } + /** + * Sets a logger for the given channel. + * + * @param LoggerInterface $logger A logger interface + * @param string $channel The channel associated with the logger (deprecation or emergency) + */ public static function setLogger(LoggerInterface $logger, $channel = 'deprecation') { self::$loggers[$channel] = $logger; @@ -163,7 +180,14 @@ class ErrorHandler } } - public function getFatalErrorHandlers() + /** + * Gets the fatal error handlers. + * + * Override this method if you want to define more fatal error handlers. + * + * @return FatalErrorHandlerInterface[] An array of FatalErrorHandlerInterface + */ + protected function getFatalErrorHandlers() { return array( new UndefinedFunctionFatalErrorHandler(),