Reflection ReflectionMethod 클래스
(PHP 5, PHP 7, PHP 8)
소개
ReflectionMethod 클래스는 메서드에 대한 정보를 보고합니다.
클래스 개요
class ReflectionMethod extends ReflectionFunctionAbstract {
/* Constants */
const int IS_STATIC = 16;
const int IS_PUBLIC = 1;
const int IS_PROTECTED = 2;
const int IS_PRIVATE = 4;
const int IS_ABSTRACT = 64;
const int IS_FINAL = 32;
/* Properties */
public string $class;
/* Inherited properties */
public string $name;
/* Methods */
public __construct(object|string $objectOrMethod, string $method)
public __construct(string $classMethod)
public static export(string $class, string $name, bool $return = false): string
public getClosure(?object $object = null): 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 */
private ReflectionFunctionAbstract::__clone(): void
public ReflectionFunctionAbstract::getAttributes(?string $name = null, int $flags = 0): array
public ReflectionFunctionAbstract::getClosureScopeClass(): ?ReflectionClass
public ReflectionFunctionAbstract::getClosureThis(): ?object
public ReflectionFunctionAbstract::getClosureUsedVariables(): array
public ReflectionFunctionAbstract::getDocComment(): string|false
public ReflectionFunctionAbstract::getEndLine(): int|false
public ReflectionFunctionAbstract::getExtension(): ?ReflectionExtension
public ReflectionFunctionAbstract::getExtensionName(): string|false
public ReflectionFunctionAbstract::getFileName(): string|false
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|false
public ReflectionFunctionAbstract::getStaticVariables(): array
public ReflectionFunctionAbstract::getTentativeReturnType(): ?ReflectionType
public ReflectionFunctionAbstract::hasReturnType(): bool
public ReflectionFunctionAbstract::hasTentativeReturnType(): 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
- 메소드 이름
- class
- 클래스 이름
미리 정의된 상수
ReflectionMethod 수정자
ReflectionMethod::IS_STATIC
- 메서드가 정적임을 나타냅니다. PHP 7.4.0 이전에는 값이
1
이었습니다. ReflectionMethod::IS_PUBLIC
- 메서드가 공용임을 나타냅니다. PHP 7.4.0 이전에는 값이
256
이었습니다. ReflectionMethod::IS_PROTECTED
- 메서드가 보호됨을 나타냅니다. PHP 7.4.0 이전에는 값이
512
였습니다. ReflectionMethod::IS_PRIVATE
- 메서드가 비공개임을 나타냅니다. PHP 7.4.0 이전에는 값이
1024
였습니다. ReflectionMethod::IS_ABSTRACT
- 메서드가 추상임을 나타냅니다. PHP 7.4.0 이전에는 값이
2
였습니다. ReflectionMethod::IS_FINAL
- 메서드가 최종적임을 나타냅니다. PHP 7.4.0 이전에는 값이
4
였습니다.
메모: 이러한 상수의 값은 PHP 버전 간에 변경될 수 있습니다. 항상 상수를 사용하고 값에 직접 의존하지 않는 것이 좋습니다.
목차
- ReflectionMethod::__construct — ReflectionMethod 생성
- ReflectionMethod::export — reflection 메서드 내보내기
- ReflectionMethod::getClosure — 메서드에 대해 동적으로 생성된 클로저를 반환합니다.
- ReflectionMethod::getDeclaringClass — 반영된 메서드에 대한 선언 클래스를 가져옵니다.
- ReflectionMethod::getModifiers — 메서드 수정자를 가져옵니다.
- ReflectionMethod::getPrototype — 메서드 프로토타입을 가져옵니다(있는 경우).
- ReflectionMethod::hasPrototype — 메서드에 프로토타입이 있는지 여부를 반환합니다.
- ReflectionMethod::invoke — 호출
- ReflectionMethod::invokeArgs — 인수 호출
- ReflectionMethod::isAbstract — 메서드가 추상인지 확인
- ReflectionMethod::isConstructor — 메소드가 생성자인지 확인
- ReflectionMethod::isDestructor — 메소드가 소멸자인지 확인
- ReflectionMethod::isFinal — 메소드가 final인지 확인
- ReflectionMethod::isPrivate — 메서드가 private인지 확인
- ReflectionMethod::isProtected — 메소드가 protected인지 확인
- ReflectionMethod::isPublic — 메소드가 public인지 확인
- ReflectionMethod::isStatic — 메서드가 static인지 확인
- ReflectionMethod::setAccessible — Set method accessibility
- ReflectionMethod::__toString — Reflection 메서드 개체의 문자열 표현을 반환합니다.