[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/libraries/vendor/symfony/error-handler/ -> ErrorHandler.php (summary)

(no description)

File Size: 798 lines (30 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

ErrorHandler:: (18 methods):
  register()
  call()
  __construct()
  setDefaultLogger()
  setLoggers()
  setExceptionHandler()
  throwAt()
  scopeAt()
  traceAt()
  screamAt()
  reRegister()
  handleError()
  handleException()
  handleFatalError()
  renderException()
  getErrorEnhancers()
  cleanTrace()
  parseAnonymousClass()


Class: ErrorHandler  - X-Ref

A generic ErrorHandler for the PHP engine.

Provides five bit fields that control how errors are handled:
- thrownErrors: errors thrown as \ErrorException
- loggedErrors: logged errors, when not @-silenced
- scopedErrors: errors thrown or logged with their local context
- tracedErrors: errors logged with their stack trace
- screamedErrors: never @-silenced errors

Each error level can be logged by a dedicated PSR-3 logger object.
Screaming only applies to logging.
Throwing takes precedence over logging.
Uncaught exceptions are logged as E_ERROR.
E_DEPRECATED and E_USER_DEPRECATED levels never throw.
E_RECOVERABLE_ERROR and E_USER_ERROR levels always throw.
Non catchable errors that can be detected at shutdown time are logged when the scream bit field allows so.
As errors have a performance cost, repeated errors are all logged, so that the developer
can see them and weight them as more important to fix than others of the same level.

register(self $handler = null, bool $replace = true)   X-Ref
Registers the error handler.


call(callable $function, ...$arguments)   X-Ref
Calls a function and turns any PHP error into \ErrorException.

return: mixed What $function(...$arguments) returns

__construct(BufferingLogger $bootstrappingLogger = null, bool $debug = false)   X-Ref
No description

setDefaultLogger(LoggerInterface $logger, $levels = \E_ALL, bool $replace = false)   X-Ref
Sets a logger to non assigned errors levels.

param: LoggerInterface $logger  A PSR-3 logger to put as default for the given levels
param: array|int|null  $levels  An array map of E_* to LogLevel::* or an integer bit field of E_* constants
param: bool            $replace Whether to replace or not any existing logger

setLoggers(array $loggers)   X-Ref
Sets a logger for each error level.

param: array $loggers Error levels to [LoggerInterface|null, LogLevel::*] map
return: array The previous map

setExceptionHandler(?callable $handler)   X-Ref
Sets a user exception handler.

param: callable(\Throwable $e)|null $handler
return: callable|null The previous exception handler

throwAt(int $levels, bool $replace = false)   X-Ref
Sets the PHP error levels that throw an exception when a PHP error occurs.

param: int  $levels  A bit field of E_* constants for thrown errors
param: bool $replace Replace or amend the previous value
return: int The previous value

scopeAt(int $levels, bool $replace = false)   X-Ref
Sets the PHP error levels for which local variables are preserved.

param: int  $levels  A bit field of E_* constants for scoped errors
param: bool $replace Replace or amend the previous value
return: int The previous value

traceAt(int $levels, bool $replace = false)   X-Ref
Sets the PHP error levels for which the stack trace is preserved.

param: int  $levels  A bit field of E_* constants for traced errors
param: bool $replace Replace or amend the previous value
return: int The previous value

screamAt(int $levels, bool $replace = false)   X-Ref
Sets the error levels where the @-operator is ignored.

param: int  $levels  A bit field of E_* constants for screamed errors
param: bool $replace Replace or amend the previous value
return: int The previous value

reRegister(int $prev)   X-Ref
Re-registers as a PHP error handler if levels changed.


handleError(int $type, string $message, string $file, int $line)   X-Ref
Handles errors by filtering then logging them according to the configured bit fields.

return: bool Returns false when no handling happens so that the PHP engine can handle the error itself

handleException(\Throwable $exception)   X-Ref
Handles an exception by logging then forwarding it to another handler.


handleFatalError(array $error = null)   X-Ref
Shutdown registered function for handling PHP fatal errors.

param: array|null $error An array as returned by error_get_last()

renderException(\Throwable $exception)   X-Ref
Renders the given exception.

As this method is mainly called during boot where nothing is yet available,
the output is always either HTML or CLI depending where PHP runs.

getErrorEnhancers()   X-Ref
Override this method if you want to define more error enhancers.

return: ErrorEnhancerInterface[]

cleanTrace(array $backtrace, int $type, string &$file, int &$line, bool $throw)   X-Ref
Cleans the trace by removing function arguments and the frames added by the error handler and DebugClassLoader.


parseAnonymousClass(string $message)   X-Ref
Parse the error message by removing the anonymous class notation
and using the parent class instead if possible.




Generated: Wed Sep 7 05:41:13 2022 Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer