ReflectionProperty 类

(PHP 5, PHP 7, PHP 8)

简介

ReflectionProperty 类报告了类的属性的相关信息。

类摘要

class ReflectionProperty implements Reflector {
/* 常量 */
const integer IS_STATIC = 1;
const integer IS_PUBLIC = 256;
const integer IS_PROTECTED = 512;
const integer IS_PRIVATE = 1024;
/* 属性 */
public $name;
public $class;
/* 方法 */
private __clone(): void
public static export(mixed $class, string $name, bool $return = ?): string
public getAttributes(?string $name = null, int $flags = 0): array
public getDocComment(): string|false
public getModifiers(): int
public getName(): string
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 __toString(): string
}

属性

name

属性的名称。只读,在尝试赋值的时候抛出 ReflectionException

class

定义的属性所在的类。只读,在尝试赋值的时候抛出 ReflectionException

预定义常量

ReflectionProperty 修饰符

ReflectionProperty::IS_STATIC

指示了 static 的属性。

ReflectionProperty::IS_PUBLIC

指示了 public 的属性。

ReflectionProperty::IS_PROTECTED

指示了 protected 的属性。

ReflectionProperty::IS_PRIVATE

指示了 private 的属性。

目录

7i24.Com