Composer API
Class

Composer\Util\Silencer

class Silencer

Temporarily suppress PHP error reporting, usually warnings and below.

Methods

static int suppress(int|null $mask = null)

Suppresses given mask or errors.

static  restore()

Restores a single state.

static mixed call(callable $callable)

Calls a specified function while silencing warnings and below.

Details

at line 33
static public int suppress(int|null $mask = null)

Suppresses given mask or errors.

Parameters

int|null $mask Error levels to suppress, default value NULL indicates all warnings and below.

Return Value

int The old error reporting level.

at line 48
static public restore()

Restores a single state.

at line 64
static public mixed call(callable $callable)

Calls a specified function while silencing warnings and below.

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

Parameters

callable $callable Function to execute.

Return Value

mixed Return value of the callback.

Exceptions

Exception Any exceptions from the callback are rethrown.