Documentation

Silencer
in package

Temporarily suppress PHP error reporting, usually warnings and below.

Tags
author

Niels Keurentjes niels.keurentjes@omines.com

Table of Contents

$stack  : array<string|int, int>
call()  : mixed
Calls a specified function while silencing warnings and below.
restore()  : mixed
Restores a single state.
suppress()  : int
Suppresses given mask or errors.

Properties

$stack

private static array<string|int, int> $stack = array()

Unpop stack

Methods

call()

Calls a specified function while silencing warnings and below.

public static call(callable $callable) : mixed

Future improvement: when PHP requirements are raised add Callable type hint (5.4) and variadic parameters (5.6)

Parameters
$callable : callable

Function to execute.

Tags
throws
Exception

Any exceptions from the callback are rethrown.

Return values
mixed

Return value of the callback.

restore()

Restores a single state.

public static restore() : mixed
Return values
mixed

suppress()

Suppresses given mask or errors.

public static suppress([int|null $mask = null ]) : int
Parameters
$mask : int|null = null

Error levels to suppress, default value NULL indicates all warnings and below.

Return values
int

The old error reporting level.

Search results