(PHP 8 >= 8.3.0)
ReflectionMethod::createFromMethodName — Créer une nouvelle ReflectionMethod
Créer une nouvelle ReflectionMethod.
method
Nom de la classe et de la méthode delimités par ::.
Retourne une nouvelle ReflectionMethod en cas de succès.
Une ReflectionException est lancée si la méthode donnée n'existe pas.
Exemple #1 Exemple avec ReflectionMethod::createFromMethodName()
<?php
class Foo {
public function bar() {
}
}
$methodInfo = ReflectionMethod::createFromMethodName("Foo::bar");
var_dump($methodInfo);
?>L'exemple ci-dessus va afficher :
object(ReflectionMethod)#1 (2) {
["name"]=>
string(3) "bar"
["class"]=>
string(3) "Foo"
}