If the method doesn't exist within the class that the ReflectionClass is reflecting an Exception is thrown.
ReflectionClass::getMethod
(PHP 5)
ReflectionClass::getMethod — Bir yöntemle ilgili bir ReflectionMethod nesnesi döndürür
Açıklama
public object ReflectionClass::getMethod
( string
$isim
)İsmi belirtilen yöntemle ilgili bir ReflectionMethod nesnesi döndürür
Uyarı
Bu işlev hala belgelendirilmemiştir; sadece değiştirge listesi mevcuttur.
Değiştirgeler
-
isim -
Bilgileri yansıtılacak yöntemin ismi.
Dönen Değerler
Bir ReflectionMethod nesnesi.
Christopher Turner
23-Mar-2011 07:04
Jarrod Nettles
22-Dec-2010 12:58
If you ever need to get the type hint of a parameter in a method use this.
<?php
//Target our class
$reflector = new ReflectionClass('MyClass');
//Get the parameters of a method
$parameters = $reflector->getMethod('FireCannon')->getParameters();
//Loop through each parameter and get the type
foreach($parameters as $param)
{
//Before you call getClass() that class must be defined!
echo $param->getClass()->name;
}
?>
