Leaf PHP

Run
in package
implements RunInterface

FinalYes

Table of Contents

Interfaces

RunInterface

Properties

$allowQuit  : bool
$canThrowExceptions  : bool
In certain scenarios, like in shutdown handler, we can not throw exceptions.
$handlerStack  : array<string|int, HandlerInterface>
$isRegistered  : bool
$sendExitCode  : int|false
$sendHttpCode  : int|false
$sendOutput  : bool
$silencedPatterns  : array<string|int, mixed>
$system  : SystemFacade

Methods

__construct()  : mixed
allowQuit()  : bool
Should Whoops allow Handlers to force the script to quit?
appendHandler()  : Run
Explicitly request your handler runs as the last of all currently registered handlers.
clearHandlers()  : Run
Clears all handlers in the handlerStack, including the default PrettyPage handler.
getHandlers()  : array<string|int, mixed>
Returns an array with all handlers, in the order they were added to the stack.
getSilenceErrorsInPaths()  : array<string|int, mixed>
Returns an array with silent errors in path configuration.
handleError()  : bool
Converts generic PHP errors to \ErrorException instances, before passing them off to be handled.
handleException()  : string
Handles an exception, ultimately generating a Whoops error page.
handleShutdown()  : void
Special case to deal with Fatal errors and the like.
popHandler()  : HandlerInterface|null
Removes and returns the last handler pushed to the handler stack.
prependHandler()  : Run
Explicitly request your handler runs as the first of all currently registered handlers.
pushHandler()  : Run
Register your handler as the last of all currently registered handlers (to be executed first).
register()  : Run
Registers this instance as an error handler.
removeFirstHandler()  : void
Removes the first handler.
removeLastHandler()  : void
Removes the last handler.
sendExitCode()  : int
Should Whoops exit with a specific code on the CLI if possible? Whoops will exit with 1 by default, but you can specify something else.
sendHttpCode()  : int|false
Should Whoops send HTTP error code to the browser if possible? Whoops will by default send HTTP code 500, but you may wish to use 502, 503, or another 5xx family code.
silenceErrorsInPaths()  : Run
Silence particular errors in particular files.
unregister()  : Run
Unregisters all handlers registered by this Whoops\Run instance.
writeToOutput()  : bool
Should Whoops push output directly to the client? If this is false, output will be returned by handleException.
getInspector()  : Inspector
resolveHandler()  : HandlerInterface
Resolves the giving handler.
writeToOutputNow()  : Run
Echo something to the browser.

Properties

$allowQuit

private bool $allowQuit = true

$canThrowExceptions

In certain scenarios, like in shutdown handler, we can not throw exceptions.

private bool $canThrowExceptions = true

$isRegistered

private bool $isRegistered

$sendExitCode

private int|false $sendExitCode = 1

$sendHttpCode

private int|false $sendHttpCode = 500

$sendOutput

private bool $sendOutput = true

$silencedPatterns

private array<string|int, mixed> $silencedPatterns = []
Tags
psalm-var

list<array{patterns: string, levels: int}>

Methods

allowQuit()

Should Whoops allow Handlers to force the script to quit?

public allowQuit([bool|int $exit = null ]) : bool
Parameters
$exit : bool|int = null
Return values
bool

appendHandler()

Explicitly request your handler runs as the last of all currently registered handlers.

public appendHandler(HandlerInterface $handler) : Run
Parameters
$handler : HandlerInterface
Return values
Run

clearHandlers()

Clears all handlers in the handlerStack, including the default PrettyPage handler.

public clearHandlers() : Run
Return values
Run

getHandlers()

Returns an array with all handlers, in the order they were added to the stack.

public getHandlers() : array<string|int, mixed>
Return values
array<string|int, mixed>

getSilenceErrorsInPaths()

Returns an array with silent errors in path configuration.

public getSilenceErrorsInPaths() : array<string|int, mixed>
Return values
array<string|int, mixed>

handleError()

Converts generic PHP errors to \ErrorException instances, before passing them off to be handled.

public handleError(int $level, string $message[, string|null $file = null ][, int|null $line = null ]) : bool

This method MUST be compatible with set_error_handler.

Parameters
$level : int
$message : string
$file : string|null = null
$line : int|null = null
Tags
throws
ErrorException
Return values
bool

handleException()

Handles an exception, ultimately generating a Whoops error page.

public handleException(Throwable $exception) : string
Parameters
$exception : Throwable
Return values
string

Output generated by handlers.

handleShutdown()

Special case to deal with Fatal errors and the like.

public handleShutdown() : void

popHandler()

Removes and returns the last handler pushed to the handler stack.

public popHandler() : HandlerInterface|null
Tags
see

Run::removeFirstHandler(), Run::removeLastHandler()

Return values
HandlerInterface|null

prependHandler()

Explicitly request your handler runs as the first of all currently registered handlers.

public prependHandler(HandlerInterface $handler) : Run
Parameters
$handler : HandlerInterface
Return values
Run

pushHandler()

Register your handler as the last of all currently registered handlers (to be executed first).

public pushHandler(callable|HandlerInterface $handler) : Run

Prefer using appendHandler and prependHandler for clarity.

Parameters
$handler : callable|HandlerInterface
Tags
throws
InvalidArgumentException

If argument is not callable or instance of HandlerInterface.

Return values
Run

register()

Registers this instance as an error handler.

public register() : Run
Return values
Run

removeFirstHandler()

Removes the first handler.

public removeFirstHandler() : void

removeLastHandler()

Removes the last handler.

public removeLastHandler() : void

sendExitCode()

Should Whoops exit with a specific code on the CLI if possible? Whoops will exit with 1 by default, but you can specify something else.

public sendExitCode([int $code = null ]) : int
Parameters
$code : int = null
Tags
throws
InvalidArgumentException
Return values
int

sendHttpCode()

Should Whoops send HTTP error code to the browser if possible? Whoops will by default send HTTP code 500, but you may wish to use 502, 503, or another 5xx family code.

public sendHttpCode([bool|int $code = null ]) : int|false
Parameters
$code : bool|int = null
Tags
throws
InvalidArgumentException
Return values
int|false

silenceErrorsInPaths()

Silence particular errors in particular files.

public silenceErrorsInPaths(array<string|int, mixed>|string $patterns[, int $levels = 10240 ]) : Run
Parameters
$patterns : array<string|int, mixed>|string

List or a single regex pattern to match.

$levels : int = 10240

Defaults to E_STRICT | E_DEPRECATED.

Return values
Run

unregister()

Unregisters all handlers registered by this Whoops\Run instance.

public unregister() : Run
Return values
Run

writeToOutput()

Should Whoops push output directly to the client? If this is false, output will be returned by handleException.

public writeToOutput([bool|int $send = null ]) : bool
Parameters
$send : bool|int = null
Return values
bool

getInspector()

private getInspector(Throwable $exception) : Inspector
Parameters
$exception : Throwable
Return values
Inspector

writeToOutputNow()

Echo something to the browser.

private writeToOutputNow(string $output) : Run
Parameters
$output : string
Return values
Run

        
On this page

Search results