ReflectionParameter::isCallable
Returns whether parameter MUST be callable
&warn.deprecated.function-8-0-0;
See the example below for an alternative way to derive this information.
&reftitle.description;
public boolReflectionParameter::isCallable
&warn.undocumented.func;
&reftitle.parameters;
&no.function.parameters;
&reftitle.returnvalues;
Returns &true; if the parameter is callable, &false; if it is
not or &null; on failure.
&reftitle.examples;
PHP 8.0.0 equivalent
As of PHP 8.0.0, the following code will report if a type supports callables,
including as part of a union.
getType();
if (!$reflectionType) return false;
$types = $reflectionType instanceof ReflectionUnionType
? $reflectionType->getTypes()
: [$reflectionType];
return in_array('callable', array_map(fn(ReflectionNamedType $t) => $t->getName(), $types));
}
?>
]]>