PHP 8.3.7 Released!

ReflectionMethod::createFromMethodName

(PHP 8 >= 8.3.0)

ReflectionMethod::createFromMethodNameCria um novo ReflectionMethod

Descrição

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

Cria um novo ReflectionMethod.

Parâmetros

method

Nome da classe e nome do método delimitados por ::.

Valor Retornado

Retorna um novo ReflectionMethod em caso de sucesso.

Erros/Exceções

Um ReflectionException será lançado se o método fornecido não existir.

Exemplos

Exemplo #1 Exemplo de ReflectionMethod::createFromMethodName()

<?php

class Foo {
public function
bar() {

}
}

$methodInfo = ReflectionMethod::createFromMethodName("Foo::bar");
var_dump($methodInfo);
?>

O exemplo acima produzirá:

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