Documentation

Callback
in package
uses StaticClass

FinalYes

PHP callable tools.

Table of Contents

Methods

__callStatic()  : mixed
Call to undefined static method.
check()  : callable
Checks that $callable is valid PHP callback. Otherwise throws exception. If the $syntax is set to true, only verifies that $callable has a valid structure to be used as a callback, but does not verify if the class or method actually exists.
invokeSafe()  : mixed
Invokes internal PHP function with own error handler.
isStatic()  : bool
Checks whether PHP callback is function or static method.
toReflection()  : ReflectionMethod|ReflectionFunction
Returns reflection for method or function used in PHP callback.
toString()  : string
Converts PHP callback to textual form. Class or method may not exists.
unwrap()  : callable|array<string|int, mixed>
Unwraps closure created by Closure::fromCallable().
__construct()  : mixed
Class is static and cannot be instantiated.

Methods

__callStatic()

Call to undefined static method.

public static __callStatic(string $name, array<string|int, mixed> $args) : mixed
Parameters
$name : string
$args : array<string|int, mixed>
Tags
throws
MemberAccessException

check()

Checks that $callable is valid PHP callback. Otherwise throws exception. If the $syntax is set to true, only verifies that $callable has a valid structure to be used as a callback, but does not verify if the class or method actually exists.

public static check(mixed $callable[, bool $syntax = false ]) : callable
Parameters
$callable : mixed
$syntax : bool = false
Tags
throws
InvalidArgumentException
Return values
callable

invokeSafe()

Invokes internal PHP function with own error handler.

public static invokeSafe(string $function, array<string|int, mixed> $args, callable $onError) : mixed
Parameters
$function : string
$args : array<string|int, mixed>
$onError : callable

isStatic()

Checks whether PHP callback is function or static method.

public static isStatic(callable $callable) : bool
Parameters
$callable : callable
Return values
bool

toReflection()

Returns reflection for method or function used in PHP callback.

public static toReflection(callable $callable) : ReflectionMethod|ReflectionFunction
Parameters
$callable : callable

type check is escalated to ReflectionException

Tags
throws
ReflectionException

if callback is not valid

Return values
ReflectionMethod|ReflectionFunction

toString()

Converts PHP callback to textual form. Class or method may not exists.

public static toString(mixed $callable) : string
Parameters
$callable : mixed
Return values
string

unwrap()

Unwraps closure created by Closure::fromCallable().

public static unwrap(Closure $closure) : callable|array<string|int, mixed>
Parameters
$closure : Closure
Return values
callable|array<string|int, mixed>

__construct()

Class is static and cannot be instantiated.

private __construct() : mixed

        
On this page

Search results