php8.5
Home/ Manual/ reflection / reflectionmethod/ ReflectionMethod::hasPrototype

ReflectionMethod::hasPrototype

PHP function Edit on GitHub ✎

(PHP 8 >= 8.2.0)

Returns whether a method has a prototype

Description

ReflectionMethod::hasPrototype(): bool

Returns whether a method has a prototype.

Parameters Parameters

Return Values

Returns true if the method has a prototype, otherwise false.

Examples

ReflectionMethod::hasPrototype example

php
<?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->hasPrototype());
?>

The above example will output:

output
bool(true)

See Also

  • ReflectionMethod::getPrototype

Source: reference/reflection/reflectionmethod/hasprototype.xml · from the official PHP manual (php/doc-en)