diff --git a/reference/reflection/reflectionfunctionabstract/getclosurecalledclass.xml b/reference/reflection/reflectionfunctionabstract/getclosurecalledclass.xml new file mode 100644 index 000000000000..40931e981b92 --- /dev/null +++ b/reference/reflection/reflectionfunctionabstract/getclosurecalledclass.xml @@ -0,0 +1,175 @@ + + + + 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 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 + <methodname>ReflectionFunctionAbstract::getClosureCalledClass</methodname>, + <methodname>ReflectionFunctionAbstract::getClosureScopeClass</methodname>, + and <methodname>ReflectionFunctionAbstract::getClosureThis</methodname> + with an instance method + + +getClosure(); +$r = new ReflectionFunction($c); +var_dump($r->getClosureThis()); // $this === $b +var_dump($r->getClosureScopeClass()); // self::class +var_dump($r->getClosureCalledClass()); // static::class + +?> +]]> + + &example.outputs; + + + string(1) "A" +} +object(ReflectionClass)#4 (1) { + ["name"]=> + string(1) "B" +} +]]> + + + + + Example showcasing difference between + <methodname>ReflectionFunctionAbstract::getClosureCalledClass</methodname>, + <methodname>ReflectionFunctionAbstract::getClosureScopeClass</methodname>, + and <methodname>ReflectionFunctionAbstract::getClosureThis</methodname> + with a static method + + + getClosure(); +$r = new ReflectionFunction($c); +var_dump($r->getClosureThis()); // NULL +var_dump($r->getClosureScopeClass()); // self::class +var_dump($r->getClosureCalledClass()); // static::class + +?> +]]> + + &example.outputs; + + + string(1) "A" +} +object(ReflectionClass)#4 (1) { + ["name"]=> + string(1) "B" +} + +]]> + + + + + + &reftitle.seealso; + + ReflectionFunctionAbstract::getClosureScopeClass + ReflectionFunctionAbstract::getClosureThis + + + + + + diff --git a/reference/reflection/reflectionfunctionabstract/getclosurescopeclass.xml b/reference/reflection/reflectionfunctionabstract/getclosurescopeclass.xml index e91d25a5e77d..4353f317b9cf 100644 --- a/reference/reflection/reflectionfunctionabstract/getclosurescopeclass.xml +++ b/reference/reflection/reflectionfunctionabstract/getclosurescopeclass.xml @@ -1,9 +1,9 @@ - + ReflectionFunctionAbstract::getClosureScopeClass - Returns the scope class associated with the closure + Returns the class corresponding to the scope inside a closure @@ -12,10 +12,11 @@ public ReflectionClassnullReflectionFunctionAbstract::getClosureScopeClass - - Get the class enclosing the closure declaration. - - + + Returns the class as a ReflectionClass that + corresponds to the scope inside the + Closure. + @@ -25,11 +26,26 @@ &reftitle.returnvalues; - - Returns the class, or &null; if the function is not a closure or if there was no enclosing class. - + + 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 &null; + is returned instead. + + + + + + + &reftitle.seealso; + + ReflectionFunctionAbstract::getClosureCalledClass + ReflectionFunctionAbstract::getClosureThis + + + - + ReflectionFunctionAbstract::getClosureThis - Returns this pointer bound to closure + Returns the object which corresponds to $this inside a closure @@ -25,12 +25,26 @@ &reftitle.returnvalues; - - Returns $this pointer. - Returns &null; in case of an error. - + + Return the object instance represented by $this inside + the Closure. + If the function is not a closure or if it has no $this &null; + is returned instead. + + + + + + + &reftitle.seealso; + + ReflectionFunctionAbstract::getClosureCalledClass + ReflectionFunctionAbstract::getClosureScopeClass + + +