(PHP 5, PHP 7, PHP 8)
The ReflectionProperty class reports information about class properties.
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 getHook(PropertyHookType $type): ?ReflectionMethod
public getHooks(): array
public getModifiers(): int
public getName(): string
public getRawValue(object $object): mixed
public getSettableType(): ?ReflectionType
public getType(): ?ReflectionType
public getValue(?object $object = null): mixed
public hasDefaultValue(): bool
public hasHook(PropertyHookType $type): bool
public hasHooks(): bool
public hasType(): bool
public isAbstract(): bool
public isDefault(): bool
public isDynamic(): bool
public isFinal(): bool
public isInitialized(?object $object = null): bool
public isLazy(object $object): bool
public isPrivate(): bool
public isPrivateSet(): bool
public isPromoted(): bool
public isProtected(): bool
public isProtectedSet(): bool
public isPublic(): bool
public isReadOnly(): bool
public isStatic(): bool
public isVirtual(): bool
#[\Deprecated] public setAccessible(bool $accessible): void
public setRawValue(object $object, mixed $value): void
public setRawValueWithoutLazyInitialization(object $object, mixed $value): void
public setValue(?object $object, mixed $value): void
public skipLazyInitialization(object $object): void
public __toString(): string}
Name of the property. Read-only, throws ReflectionException in attempt to write.
Name of the class where the property is defined. Read-only, throws ReflectionException in attempt to write.
ReflectionProperty::IS_STATIC int Indicates static properties. Prior to PHP 7.4.0, the value was 1.
ReflectionProperty::IS_READONLY int Indicates readonly properties. Available as of PHP 8.1.0.
ReflectionProperty::IS_PUBLIC int Indicates public properties. Prior to PHP 7.4.0, the value was 256.
ReflectionProperty::IS_PROTECTED int Indicates protected properties. Prior to PHP 7.4.0, the value was 512.
ReflectionProperty::IS_PRIVATE int Indicates private properties. Prior to PHP 7.4.0, the value was 1024.
ReflectionProperty::IS_ABSTRACT int ReflectionProperty::IS_PROTECTED_SET int ReflectionProperty::IS_PRIVATE_SET int ReflectionProperty::IS_VIRTUAL int ReflectionProperty::IS_FINAL int 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.
| Version | Description |
|---|---|
| 8.4.0 | The class constants are now typed. |
| 8.4.0 | Added ReflectionProperty::IS_VIRTUAL, ReflectionProperty::IS_PRIVATE_SET, ReflectionProperty::IS_PROTECTED_SET, ReflectionProperty::IS_ABSTRACT, and ReflectionProperty::IS_FINAL. |
| 8.0.0 | ReflectionProperty::export() was removed. |
© 1997–2025 The PHP Documentation Group
Licensed under the Creative Commons Attribution License v3.0 or later.
https://www.php.net/manual/en/class.reflectionproperty.php