The ReflectionMethod class

Introduction

The ReflectionMethod class reports information about a method.

Class synopsis

ReflectionMethod
extends ReflectionFunctionAbstract
/* Constants */
public const int ReflectionMethod::IS_STATIC;
public const int ReflectionMethod::IS_PUBLIC;
public const int ReflectionMethod::IS_PROTECTED;
public const int ReflectionMethod::IS_PRIVATE;
public const int ReflectionMethod::IS_ABSTRACT;
public const int ReflectionMethod::IS_FINAL;
/* Properties */
public string $class;
/* Inherited properties */
public string $name;
/* Methods */
public ReflectionMethod::__construct(objectstring $objectOrMethod, string $method)
public ReflectionMethod::__construct(string $classMethod)
public static static ReflectionMethod::createFromMethodName(string $method)
public static string ReflectionMethod::export(string $class, string $name, bool $return = false)
public Closure ReflectionMethod::getClosure(objectnull $object = null)
public ReflectionClass ReflectionMethod::getDeclaringClass()
public int ReflectionMethod::getModifiers()
public ReflectionMethod ReflectionMethod::getPrototype()
public bool ReflectionMethod::hasPrototype()
public mixed ReflectionMethod::invoke(objectnull $object, mixed ...$args)
public mixed ReflectionMethod::invokeArgs(objectnull $object, array $args)
public bool ReflectionMethod::isAbstract()
public bool ReflectionMethod::isConstructor()
public bool ReflectionMethod::isDestructor()
public bool ReflectionMethod::isFinal()
public bool ReflectionMethod::isPrivate()
public bool ReflectionMethod::isProtected()
public bool ReflectionMethod::isPublic()
public void ReflectionMethod::setAccessible(bool $accessible)
public string ReflectionMethod::__toString()
/* Inherited methods */
private void __clone()
public array getAttributes(stringnull $name = null, int $flags = 0)
public ReflectionClassnull getClosureScopeClass()
public objectnull getClosureThis()
public array getClosureUsedVariables()
public stringfalse getDocComment()
public intfalse getEndLine()
public ReflectionExtensionnull getExtension()
public stringfalse getExtensionName()
public stringfalse getFileName()
public string getName()
public string getNamespaceName()
public int getNumberOfParameters()
public int getNumberOfRequiredParameters()
public array getParameters()
public ReflectionTypenull getReturnType()
public string getShortName()
public intfalse getStartLine()
public array getStaticVariables()
public ReflectionTypenull getTentativeReturnType()
public bool hasReturnType()
public bool hasTentativeReturnType()
public bool inNamespace()
public bool isClosure()
public bool isDeprecated()
public bool isGenerator()
public bool isInternal()
public bool isStatic()
public bool isUserDefined()
public bool isVariadic()
public bool returnsReference()
abstract public void __toString()

Properties

name

Method name

class

Class name

Predefined Constants

ReflectionMethod Modifiers

ReflectionMethod::IS_STATIC

Indicates that the method is static. Prior to PHP 7.4.0, the value was 1.

ReflectionMethod::IS_PUBLIC

Indicates that the method is public. Prior to PHP 7.4.0, the value was 256.

ReflectionMethod::IS_PROTECTED

Indicates that the method is protected. Prior to PHP 7.4.0, the value was 512.

ReflectionMethod::IS_PRIVATE

Indicates that the method is private. Prior to PHP 7.4.0, the value was 1024.

ReflectionMethod::IS_ABSTRACT

Indicates that the method is abstract. Prior to PHP 7.4.0, the value was 2.

ReflectionMethod::IS_FINAL

Indicates that the method is final. Prior to PHP 7.4.0, the value was 4.

Note:

The values of these constants may change between PHP versions. It is recommended to always use the constants and not rely on the values directly.

Changelog

Version Description
8.0.0 ReflectionMethod::export was removed.
Table of Contents