CallbackDescriber
This utility class MUST be used to generate human-readable descriptions for any PHP callable.
Description
It SHALL support closures, array callables, invokable objects, and string callables. All methods MUST be static and MUST NOT throw exceptions.
Methods
Returns a human-readable description for a callable.
Returns a description for an array callable.
Returns a description for a Closure, including file and line if available.
Returns a human-readable description for a callable.
public
static
describe(
callable
$callback) : string
Description
This method MUST support closures, array callables, invokable objects, and string callables.
Parameters
$callback
:
callable
Description
the callable to describe
Return values
Description
the description of the callable
Returns a description for an array callable.
private
static
describeArrayCallable(
array<string|int, mixed>
$callback) : string
Parameters
$callback
:
array<string|int, mixed>
Return values
Description
the description of the array callable
Returns a description for a Closure, including file and line if available.
private
static
describeClosure(Closure
$closure) : string
Parameters
$closure
:
Closure
Description
the closure to describe
Return values
Description
the description of the closure