downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

ReflectionClass::getMethods> <ReflectionClass::getInterfaces
[edit] Last updated: Fri, 25 May 2012

view this page in

ReflectionClass::getMethod

(PHP 5)

ReflectionClass::getMethodRécupère un objet ReflectionMethod

Description

public ReflectionMethod ReflectionClass::getMethod ( string $name )

Récupère un objet ReflectionMethod sur une méthode.

Avertissement

Cette fonction n'est pas documentée et seule la liste des arguments est disponible.

Liste de paramètres

name

Le nom de la méthode à refléter.

Valeurs de retour

Un objet ReflectionMethod.

Voir aussi

  • ReflectionClass::getMethod()



add a note add a note User Contributed Notes ReflectionClass::getMethod
Christopher Turner 23-Mar-2011 01:04
If the method doesn't exist within the class that the ReflectionClass is reflecting an Exception is thrown.
Jarrod Nettles 22-Dec-2010 05: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;
}

?>

 
show source | credits | stats | sitemap | contact | advertising | mirror sites