ClassNotFoundFatalErrorHandler
in package
implements
FatalErrorHandlerInterface
ErrorHandler for classes that do not exist.
Tags
Interfaces, Classes, Traits and Enums
- FatalErrorHandlerInterface
- Attempts to convert fatal errors to exceptions.
Table of Contents
- handleError() : FatalErrorException|null
- Attempts to convert an error into an exception.
- classExists() : bool
- convertFileToClass() : string|null
- findClassInPath() : array<string|int, mixed>
- getClassCandidates() : array<string|int, mixed>
- Tries to guess the full namespace for a given class name.
Methods
handleError()
Attempts to convert an error into an exception.
public
handleError(array<string|int, mixed> $error, FatalErrorException $exception) : FatalErrorException|null
Parameters
- $error : array<string|int, mixed>
-
An array as returned by error_get_last()
- $exception : FatalErrorException
Return values
FatalErrorException|null —A FatalErrorException instance if the class is able to convert the error, null otherwise
classExists()
private
classExists(string $class) : bool
Parameters
- $class : string
Return values
bool —convertFileToClass()
private
convertFileToClass(string $path, string $file, string $prefix) : string|null
Parameters
- $path : string
- $file : string
- $prefix : string
Return values
string|null —findClassInPath()
private
findClassInPath(string $path, string $class, string $prefix) : array<string|int, mixed>
Parameters
- $path : string
- $class : string
- $prefix : string
Return values
array<string|int, mixed> —getClassCandidates()
Tries to guess the full namespace for a given class name.
private
getClassCandidates(string $class) : array<string|int, mixed>
By default, it looks for PSR-0 and PSR-4 classes registered via a Symfony or a Composer autoloader (that should cover all common cases).
Parameters
- $class : string
-
A class name (without its namespace)
Return values
array<string|int, mixed> —An array of possible fully qualified class names