16
16
use Symfony \Component \Debug \Exception \FatalErrorException ;
17
17
use Symfony \Component \Debug \FatalErrorHandler \UndefinedFunctionFatalErrorHandler ;
18
18
use Symfony \Component \Debug \FatalErrorHandler \ClassNotFoundFatalErrorHandler ;
19
+ use Symfony \Component \Debug \FatalErrorHandler \FatalErrorHandlerInterface ;
19
20
20
21
/**
21
22
* ErrorHandler.
@@ -57,7 +58,7 @@ class ErrorHandler
57
58
/**
58
59
* Registers the error handler.
59
60
*
60
- * @param integer $level The level at which the conversion to Exception is done (null to use the error_reporting() value and 0 to disable)
61
+ * @param integer $level The level at which the conversion to Exception is done (null to use the error_reporting() value and 0 to disable)
61
62
* @param Boolean $displayErrors Display errors (for dev environment) or just log they (production usage)
62
63
*
63
64
* @return The registered error handler
@@ -76,16 +77,32 @@ public static function register($level = null, $displayErrors = true)
76
77
return $ handler ;
77
78
}
78
79
80
+ /**
81
+ * Sets the level at which the conversion to Exception is done.
82
+ *
83
+ * @param integer|null $level The level (null to use the error_reporting() value and 0 to disable)
84
+ */
79
85
public function setLevel ($ level )
80
86
{
81
87
$ this ->level = null === $ level ? error_reporting () : $ level ;
82
88
}
83
89
90
+ /**
91
+ * Sets the display_errors flag value.
92
+ *
93
+ * @param integer $displayErrors The display_errors flag value
94
+ */
84
95
public function setDisplayErrors ($ displayErrors )
85
96
{
86
97
$ this ->displayErrors = $ displayErrors ;
87
98
}
88
99
100
+ /**
101
+ * Sets a logger for the given channel.
102
+ *
103
+ * @param LoggerInterface $logger A logger interface
104
+ * @param string $channel The channel associated with the logger (deprecation or emergency)
105
+ */
89
106
public static function setLogger (LoggerInterface $ logger , $ channel = 'deprecation ' )
90
107
{
91
108
self ::$ loggers [$ channel ] = $ logger ;
@@ -163,7 +180,14 @@ public function handleFatal()
163
180
}
164
181
}
165
182
166
- public function getFatalErrorHandlers ()
183
+ /**
184
+ * Gets the fatal error handlers.
185
+ *
186
+ * Override this method if you want to define more fatal error handlers.
187
+ *
188
+ * @return FatalErrorHandlerInterface[] An array of FatalErrorHandlerInterface
189
+ */
190
+ protected function getFatalErrorHandlers ()
167
191
{
168
192
return array (
169
193
new UndefinedFunctionFatalErrorHandler (),
0 commit comments