| 
 | ReflectionFunctionAbstract::getClosureThisReturns the object which corresponds to $this inside a closure Description
   public objectnull ReflectionFunctionAbstract::getClosureThis() If the function is a non-static closure, get the object bound to $this inside the closure. ParametersThis function has no parameters. Return Values
   Return the object instance represented by $this inside
   the Closure.
   If the function is not a closure or if it has no $this  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
 |