trait InteractsWithExceptionHandling

Traits

Properties

protected ExceptionHandler|null $originalExceptionHandler

The original exception handler.

Methods

string
firstClosureParameterType(Closure $closure)

Get the class name of the first parameter of the given Closure.

array
firstClosureParameterTypes(Closure $closure)

Get the class names of the first parameter of the given Closure, including union types.

array
closureParameterTypes(Closure $closure)

Get the class names / types of the parameters of the given Closure.

array
closureReturnTypes(Closure $closure)

Get the class names / types of the return type of the given Closure.

handleExceptions(array $exceptions)

Only handle the given exceptions via the exception handler.

handleValidationExceptions()

Only handle validation exceptions via the exception handler.

withoutExceptionHandling(array $except = [])

Disable exception handling for the test.

__construct(ExceptionHandler $originalHandler, array $except = [])

No description

void
report(Throwable $e)

Report or log an exception.

bool
shouldReport(Throwable $e)

Determine if the exception should be reported.

Response
render(Request $request, Throwable $e)

Render an exception into an HTTP response.

void
renderForConsole(OutputInterface $output, Throwable $e)

Render an exception to the console.

void
afterResponse(callable $callback)

Register a callback to be called after an HTTP error response is rendered.

Details

in ReflectsClosures at line 25
protected string firstClosureParameterType(Closure $closure)

Get the class name of the first parameter of the given Closure.

Parameters

Closure $closure

Return Value

string

Exceptions

ReflectionException
RuntimeException

in ReflectsClosures at line 48
protected array firstClosureParameterTypes(Closure $closure)

Get the class names of the first parameter of the given Closure, including union types.

Parameters

Closure $closure

Return Value

array

Exceptions

ReflectionException
RuntimeException

in ReflectsClosures at line 74
protected array closureParameterTypes(Closure $closure)

Get the class names / types of the parameters of the given Closure.

Parameters

Closure $closure

Return Value

array

Exceptions

ReflectionException

in ReflectsClosures at line 94
protected array closureReturnTypes(Closure $closure)

Get the class names / types of the return type of the given Closure.

Parameters

Closure $closure

Return Value

array

Exceptions

ReflectionException

at line 32
protected InteractsWithExceptionHandling withExceptionHandling()

Restore exception handling.

at line 50
protected InteractsWithExceptionHandling handleExceptions(array $exceptions)

Only handle the given exceptions via the exception handler.

Parameters

array $exceptions

Return Value

InteractsWithExceptionHandling

at line 58
protected InteractsWithExceptionHandling handleValidationExceptions()

Only handle validation exceptions via the exception handler.

at line 68
protected InteractsWithExceptionHandling withoutExceptionHandling(array $except = [])

Disable exception handling for the test.

Parameters

array $except

Return Value

InteractsWithExceptionHandling

at line 82
__construct(ExceptionHandler $originalHandler, array $except = [])

No description

Parameters

ExceptionHandler $originalHandler
array $except

at line 91
void report(Throwable $e)

Report or log an exception.

Parameters

Throwable $e

Return Value

void

at line 98
bool shouldReport(Throwable $e)

Determine if the exception should be reported.

Parameters

Throwable $e

Return Value

bool

at line 108
Response render(Request $request, Throwable $e)

Render an exception into an HTTP response.

Parameters

Request $request
Throwable $e

Return Value

Response

Exceptions

Throwable

at line 130
void renderForConsole(OutputInterface $output, Throwable $e)

Render an exception to the console.

Parameters

OutputInterface $output
Throwable $e

Return Value

void

at line 138
void afterResponse(callable $callback)

Register a callback to be called after an HTTP error response is rendered.

Parameters

callable $callback

Return Value

void