The ReflectionMethod class
(PHP 5, PHP 7, PHP 8)
Introduction
The ReflectionMethod class reports information about a method.
Class synopsis
/* Constants */
/* Properties */
/* Inherited properties */
/* Methods */
/* Inherited methods */
}Properties
- name
Method name
- class
Class name
Predefined Constants
ReflectionMethod Modifiers
ReflectionMethod::IS_STATICintIndicates that the method is static. Prior to PHP 7.4.0, the value was
1.ReflectionMethod::IS_PUBLICintIndicates that the method is public. Prior to PHP 7.4.0, the value was
256.ReflectionMethod::IS_PROTECTEDintIndicates that the method is protected. Prior to PHP 7.4.0, the value was
512.ReflectionMethod::IS_PRIVATEintIndicates that the method is private. Prior to PHP 7.4.0, the value was
1024.ReflectionMethod::IS_ABSTRACTintIndicates that the method is abstract. Prior to PHP 7.4.0, the value was
2.ReflectionMethod::IS_FINALintIndicates 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.4.0 | The class constants are now typed. |
| 8.0.0 | ReflectionMethod::export() was removed. |
Table of Contents
- ReflectionMethod::__construct — Constructs a ReflectionMethod
- ReflectionMethod::createFromMethodName — Creates a new 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::hasPrototype — Returns whether a method has a prototype
- 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::setAccessible — Set method accessibility
- ReflectionMethod::__toString — Returns the string representation of the Reflection method object
↑ and ↓ to navigate • Enter to select • Esc to close • / to open