Oihana PHP

CallableType

Defines the possible types of a callable reference.

This class provides constants that can be used to identify the type of a callable in a standardized way. These types are returned by callableType() and can be used for validation or normalization of callables in your code.

Callable types:

  • CLOSURE : A Closure (anonymous function or arrow function).
  • FUNCTION : A plain named function.
  • INVOCABLE : An object implementing __invoke().
  • STATIC : A static class method (["ClassName", "method"] or "ClassName::method").
  • OBJECT : An object method ([$object, "method"]).
  • UNKNOWN : Any other callable type not recognized or normalized.
Tags
author

Marc Alcaraz (ekameleon)

since
1.0.7

Table of Contents

Constants

CLOSURE  = 'closure'
A Closure (anonymous function or arrow function).
FUNCTION  = 'function'
A plain named function.
INVOCABLE  = 'invocable'
An object implementing __invoke().
OBJECT  = 'object'
An object method ([$object, "method"]).
STATIC  = 'static'
A static class method (["ClassName", "method"] or "ClassName::method").
UNKNOWN  = 'unknown'
Any other callable type not recognized or normalized.

Constants

CLOSURE

A Closure (anonymous function or arrow function).

public mixed CLOSURE = 'closure'

FUNCTION

A plain named function.

public mixed FUNCTION = 'function'

INVOCABLE

An object implementing __invoke().

public mixed INVOCABLE = 'invocable'

OBJECT

An object method ([$object, "method"]).

public mixed OBJECT = 'object'

STATIC

A static class method (["ClassName", "method"] or "ClassName::method").

public mixed STATIC = 'static'

UNKNOWN

Any other callable type not recognized or normalized.

public mixed UNKNOWN = 'unknown'

        
On this page

Search results