ReflectionFunctionAbstract::getClosureCalledClass
Returns the class corresponding to static:: inside a closure
&reftitle.description;
public ReflectionClassnullReflectionFunctionAbstract::getClosureCalledClass
Returns the class as a ReflectionClass that
corresponds to resolving the class name corresponding to static:: inside the
Closure.
&reftitle.parameters;
&no.function.parameters;
&reftitle.returnvalues;
Returns a ReflectionClass corresponding to the class
represented by static:: in the Closure.
If the function is not a closure or if it has global scope &null;
is returned instead.
&reftitle.examples;
Example showcasing difference between
ReflectionFunctionAbstract::getClosureCalledClass,
ReflectionFunctionAbstract::getClosureScopeClass,
and ReflectionFunctionAbstract::getClosureThis
with a closure in the object context
getClosure();
$r = new ReflectionFunction($c);
var_dump($r->getClosureThis()); // $this === $b, since a non-static closure take the object context
var_dump($r->getClosureScopeClass()); // Corresponds to the self::class resolution inside a closure
var_dump($r->getClosureCalledClass()); // Corresponds to the static::class resolution inside a closure
?>
]]>
&example.outputs;
string(1) "A"
}
object(ReflectionClass)#4 (1) {
["name"]=>
string(1) "B"
}
]]>
Example showcasing difference between
ReflectionFunctionAbstract::getClosureCalledClass,
ReflectionFunctionAbstract::getClosureScopeClass,
and ReflectionFunctionAbstract::getClosureThis
with a static closure without an object context
getClosure();
$r = new ReflectionFunction($c);
var_dump($r->getClosureThis()); // NULL, since the pseudo-variable $this is not available in a static context
var_dump($r->getClosureScopeClass()); // Corresponds to the self::class resolution inside a closure
var_dump($r->getClosureCalledClass()); // Corresponds to the static::class resolution inside a closure
?>
]]>
&example.outputs;
string(1) "A"
}
object(ReflectionClass)#4 (1) {
["name"]=>
string(1) "B"
}
]]>
&reftitle.seealso;
ReflectionFunctionAbstract::getClosureScopeClass
ReflectionFunctionAbstract::getClosureThis