Reflection ReflectionProperty 클래스

(PHP 5, PHP 7, PHP 8)


소개

ReflectionProperty 클래스는 클래스 속성에 대한 정보를 보고합니다.


클래스 개요

                  
class ReflectionProperty implements Reflector {

  /* Constants */
  const int IS_STATIC = 16;
  const int IS_PUBLIC = 1;
  const int IS_PROTECTED = 2;
  const int IS_PRIVATE = 4;

  /* Properties */
  public string $name;
  public string $class;

  /* Methods */
  public __construct(object|string $class, string $property)
  private __clone(): void
  public static export(mixed $class, string $name, bool $return = ?): string
  public getAttributes(?string $name = null, int $flags = 0): array
  public getDeclaringClass(): ReflectionClass
  public getDefaultValue(): mixed
  public getDocComment(): string|false
  public getModifiers(): int
  public getName(): string
  public getType(): ?ReflectionType
  public getValue(?object $object = null): mixed
  public hasDefaultValue(): bool
  public hasType(): bool
  public isDefault(): bool
  public isInitialized(?object $object = null): bool
  public isPrivate(): bool
  public isPromoted(): bool
  public isProtected(): bool
  public isPublic(): bool
  public isReadOnly(): bool
  public isStatic(): bool
  public setAccessible(bool $accessible): void
  public setValue(object $object, mixed $value): void
  public setValue(mixed $value): void
  public __toString(): string
}
                  
                

Properties

name
속성의 이름입니다. 읽기 전용, 쓰기 시도 시 ReflectionException이 발생합니다.
class
속성이 정의된 클래스의 이름입니다. 읽기 전용, 쓰기 시도 시 ReflectionException이 발생합니다.

미리 정의된 상수


ReflectionProperty 수정자

ReflectionProperty::IS_STATIC
static 속성을 나타냅니다. PHP 7.4.0 이전에는 값이 1이었습니다.
ReflectionProperty::IS_PUBLIC
public 속성을 나타냅니다. PHP 7.4.0 이전에는 값이 256이었습니다.
ReflectionProperty::IS_PROTECTED
protected 속성을 나타냅니다. PHP 7.4.0 이전에는 값이 512였습니다.
ReflectionProperty::IS_PRIVATE
private 속성을 나타냅니다. PHP 7.4.0 이전에는 값이 1024였습니다.

메모: 이러한 상수의 값은 PHP 버전 간에 변경될 수 있습니다. 항상 상수를 사용하고 값에 직접 의존하지 않는 것이 좋습니다.


목차