|
ReflectionFunctionAbstract::getClosureScopeClassReturns the class corresponding to the scope inside a closure Description
public ReflectionClassnull ReflectionFunctionAbstract::getClosureScopeClass()
Returns the class as a ReflectionClass that corresponds to the scope inside the Closure. ParametersThis function has no parameters. Return Values
Returns a ReflectionClass corresponding to the class
whose scope is being used inside the Closure.
If the function is not a closure or if it has global scope ExamplesExample #1 Example showcasing difference between ReflectionFunctionAbstract::getClosureCalledClass, ReflectionFunctionAbstract::getClosureScopeClass, and ReflectionFunctionAbstract::getClosureThis with a closure in the object context
The above example will output: string(1) "A" string(1) "B" object(B)#1 (0) { } object(ReflectionClass)#4 (1) { ["name"]=> string(1) "A" } object(ReflectionClass)#4 (1) { ["name"]=> string(1) "B" } Example #2 Example showcasing difference between ReflectionFunctionAbstract::getClosureCalledClass, ReflectionFunctionAbstract::getClosureScopeClass, and ReflectionFunctionAbstract::getClosureThis with a static closure without an object context
The above example will output: string(1) "A" string(1) "B" NULL object(ReflectionClass)#4 (1) { ["name"]=> string(1) "A" } object(ReflectionClass)#4 (1) { ["name"]=> string(1) "B" } See Also
|