CakeFest 2024: The Official CakePHP Conference

ReflectionMethod::getDeclaringClass

(PHP 5, PHP 7, PHP 8)

ReflectionMethod::getDeclaringClassYansıtılan yöntemin bildirildiği sınıfı döndürür

Açıklama

public ReflectionMethod::getDeclaringClass(): ReflectionClass

Yansıtılan yöntemin bildirildiği sınıfı döndürür.

Bağımsız Değişkenler

Bu işlevin bağımsız değişkeni yoktur.

Dönen Değerler

Yansıtılan yöntemin parçası olduğu sınıfın ReflectionClass nesnesi.

Örnekler

Ö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"
}

Ayrıca Bakınız

add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top