(PHP 5, PHP 7, PHP 8)
ReflectionMethod::getDeclaringClass — Yansıtılan yöntemin bildirildiği sınıfı döndürür
Yansıtılan yöntemin bildirildiği sınıfı döndürür.
Bu işlevin bağımsız değişkeni yoktur.
Yansıtılan yöntemin parçası olduğu sınıfın ReflectionClass nesnesi.
Örnek 1 - ReflectionMethod::getDeclaringClass() örneği
<?php
class HelloWorld {
protected function sayHelloTo($name) {
return 'Hello ' . $name;
}
}
$reflectionMethod = new ReflectionMethod(new HelloWorld(), 'sayHelloTo');
var_dump($reflectionMethod->getDeclaringClass());
?>Yukarıdaki örneğin çıktısı:
object(ReflectionClass)#2 (1) {
["name"]=>
string(10) "HelloWorld"
}