PHP 8.3.7 Released!

ReflectionMethod::createFromMethodName

(PHP 8 >= 8.3.0)

ReflectionMethod::createFromMethodNameCréer une nouvelle ReflectionMethod

Description

public static ReflectionMethod::createFromMethodName(string $method): static

Créer une nouvelle ReflectionMethod.

Liste de paramètres

method

Nom de la classe et de la méthode delimités par ::.

Valeurs de retour

Retourne une nouvelle ReflectionMethod en cas de succès.

Erreurs / Exceptions

Une ReflectionException est lancée si la méthode donnée n'existe pas.

Exemples

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"
}
add a note

User Contributed Notes

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