The ReflectionProperty class
(PHP 5, PHP 7, PHP 8)
Introduction
The ReflectionProperty class reports information about class properties.
Class synopsis
Properties
- name
-
Name of the property. Read-only, throws ReflectionException in attempt to write.
- class
-
Name of the class where the property is defined. Read-only, throws ReflectionException in attempt to write.
Predefined Constants
ReflectionProperty Modifiers
ReflectionProperty::IS_STATIC
-
Indicates static properties. Prior to PHP 7.4.0, the value was
1
. ReflectionProperty::IS_PUBLIC
-
Indicates public properties. Prior to PHP 7.4.0, the value was
256
. ReflectionProperty::IS_PROTECTED
-
Indicates protected properties. Prior to PHP 7.4.0, the value was
512
. ReflectionProperty::IS_PRIVATE
-
Indicates private properties. Prior to PHP 7.4.0, the value was
1024
.
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.
Table of Contents
- ReflectionProperty::__clone — Clone
- ReflectionProperty::__construct — Construct a ReflectionProperty object
- ReflectionProperty::export — Export
- ReflectionProperty::getAttributes — Gets Attributes
- ReflectionProperty::getDeclaringClass — Gets declaring class
- ReflectionProperty::getDefaultValue — Returns the default value declared for a property
- ReflectionProperty::getDocComment — Gets the property doc comment
- ReflectionProperty::getModifiers — Gets the property modifiers
- ReflectionProperty::getName — Gets property name
- ReflectionProperty::getType — Gets a property's type
- ReflectionProperty::getValue — Gets value
- ReflectionProperty::hasDefaultValue — Checks if property has a default value declared
- ReflectionProperty::hasType — Checks if property has a type
- ReflectionProperty::isDefault — Checks if property is a default property
- ReflectionProperty::isInitialized — Checks whether a property is initialized
- ReflectionProperty::isPrivate — Checks if property is private
- ReflectionProperty::isPromoted — Checks if property is promoted
- ReflectionProperty::isProtected — Checks if property is protected
- ReflectionProperty::isPublic — Checks if property is public
- ReflectionProperty::isReadOnly — Checks if property is readonly
- ReflectionProperty::isStatic — Checks if property is static
- ReflectionProperty::setAccessible — Set property accessibility
- ReflectionProperty::setValue — Set property value
- ReflectionProperty::__toString — To string