PHP 8.6.0 Beta 1 is available for testing

ReflectionMethod::getPrototype

(PHP 5 >= 5.1.2, PHP 7, PHP 8)

ReflectionMethod::getPrototypeObtiene el prototipo del método (si existe)

Descripción

public function ReflectionMethod::getPrototype(): ReflectionMethod

Devuelve el prototipo del método.

Parámetros

Esta función no contiene ningún parámetro.

Valores devueltos

Un objeto ReflectionMethod instancia del método.

Errores/Excepciones

Se lanzará una excepción ReflectionException si el método no posee un prototipo.

Ejemplos

Ejemplo #1 Ejemplo con ReflectionMethod::getPrototype()

<?php
class Hello {
 public function sayHelloTo($name) {
 return 'Hello ' . $name;
 }
}
class HelloWorld extends Hello {
 public function sayHelloTo($name) {
 return 'Hello world: ' . $name;
 }
}
$reflectionMethod = new ReflectionMethod('HelloWorld', 'sayHelloTo');
var_dump($reflectionMethod->getPrototype());
?>

El ejemplo anterior mostrará:

object(ReflectionMethod)#2 (2) {
 ["name"]=>
 string(10) "sayHelloTo"
 ["class"]=>
 string(5) "Hello"
}

Véase también

Found A Problem?

Learn How To Improve This PageSubmit a Pull RequestReport a Bug
+add a note

User Contributed Notes

There are no user contributed notes for this page.

AltStyle によって変換されたページ (->オリジナル) /