# The ReflectionMethod class

(PHP 5, PHP 7)

## Introduction

The ReflectionMethod class reports information about a method.

## Class synopsis

ReflectionMethod extends ReflectionFunctionAbstract implements Reflector {
/* Constants */
const int IS_STATIC = 1 ;
const int IS_PUBLIC = 256 ;
const int IS_PROTECTED = 512 ;
const int IS_PRIVATE = 1024 ;
const int IS_ABSTRACT = 2 ;
const int IS_FINAL = 4 ;
/* Properties */
public $name ;
public $class ;
/* Methods */
public __construct ( string|object `$class` , string `$name` )
public static export ( string `$class` , string `$name` [, bool `$return` = `FALSE` ] ) : string
public getClosure ( object `$object` ) : Closure
public getDeclaringClass ( ) : ReflectionClass
public getModifiers ( ) : int
public getPrototype ( ) : ReflectionMethod
public invoke ( object `$object` , mixed `...$args` ) : mixed
public invokeArgs ( object `$object` , array `$args` ) : mixed
public isAbstract ( ) : bool
public isConstructor ( ) : bool
public isDestructor ( ) : bool
public isFinal ( ) : bool
public isPrivate ( ) : bool
public isProtected ( ) : bool
public isPublic ( ) : bool
public isStatic ( ) : bool
public setAccessible ( bool `$accessible` ) : void
public __toString ( ) : string
/* Inherited methods */
final private ReflectionFunctionAbstract::__clone ( ) : void
public ReflectionFunctionAbstract::getClosureScopeClass ( ) : ReflectionClass
public ReflectionFunctionAbstract::getClosureThis ( ) : object
public ReflectionFunctionAbstract::getDocComment ( ) : string
public ReflectionFunctionAbstract::getEndLine ( ) : int
public ReflectionFunctionAbstract::getExtension ( ) : ReflectionExtension
public ReflectionFunctionAbstract::getExtensionName ( ) : string
public ReflectionFunctionAbstract::getFileName ( ) : string
public ReflectionFunctionAbstract::getName ( ) : string
public ReflectionFunctionAbstract::getNamespaceName ( ) : string
public ReflectionFunctionAbstract::getNumberOfParameters ( ) : int
public ReflectionFunctionAbstract::getNumberOfRequiredParameters ( ) : int
public ReflectionFunctionAbstract::getParameters ( ) : array
public ReflectionFunctionAbstract::getReturnType ( ) : ReflectionType
public ReflectionFunctionAbstract::getShortName ( ) : string
public ReflectionFunctionAbstract::getStartLine ( ) : int
public ReflectionFunctionAbstract::getStaticVariables ( ) : array
public ReflectionFunctionAbstract::hasReturnType ( ) : bool
public ReflectionFunctionAbstract::inNamespace ( ) : bool
public ReflectionFunctionAbstract::isClosure ( ) : bool
public ReflectionFunctionAbstract::isDeprecated ( ) : bool
public ReflectionFunctionAbstract::isGenerator ( ) : bool
public ReflectionFunctionAbstract::isInternal ( ) : bool
public ReflectionFunctionAbstract::isUserDefined ( ) : bool
public ReflectionFunctionAbstract::isVariadic ( ) : bool
public ReflectionFunctionAbstract::returnsReference ( ) : bool
abstract public ReflectionFunctionAbstract::__toString ( ) : void
}

## Properties

name

  Method name

class

  Class name

## Predefined Constants

## ReflectionMethod Modifiers

`ReflectionMethod::IS_STATIC`

  Indicates that the method is static.

`ReflectionMethod::IS_PUBLIC`

  Indicates that the method is public.

`ReflectionMethod::IS_PROTECTED`

  Indicates that the method is protected.

`ReflectionMethod::IS_PRIVATE`

  Indicates that the method is private.

`ReflectionMethod::IS_ABSTRACT`

  Indicates that the method is abstract.

`ReflectionMethod::IS_FINAL`

  Indicates that the method is final.

## Table of Contents

- ReflectionMethod::__construct — Constructs a ReflectionMethod
- ReflectionMethod::export — Export a reflection method
- ReflectionMethod::getClosure — Returns a dynamically created closure for the method
- ReflectionMethod::getDeclaringClass — Gets declaring class for the reflected method
- ReflectionMethod::getModifiers — Gets the method modifiers
- ReflectionMethod::getPrototype — Gets the method prototype (if there is one)
- ReflectionMethod::invoke — Invoke
- ReflectionMethod::invokeArgs — Invoke args
- ReflectionMethod::isAbstract — Checks if method is abstract
- ReflectionMethod::isConstructor — Checks if method is a constructor
- ReflectionMethod::isDestructor — Checks if method is a destructor
- ReflectionMethod::isFinal — Checks if method is final
- ReflectionMethod::isPrivate — Checks if method is private
- ReflectionMethod::isProtected — Checks if method is protected
- ReflectionMethod::isPublic — Checks if method is public
- ReflectionMethod::isStatic — Checks if method is static
- ReflectionMethod::setAccessible — Set method accessibility
- ReflectionMethod::__toString — Returns the string representation of the Reflection method object