reference/reflection/reflectionproperty/getvalue.xml
ec2fe9a592f794978114ef5021db9f1d00c2e05d
...
...
@@ -1,6 +1,5 @@
1
1
<?xml version="1.0" encoding="utf-8"?>
2
2
<!-- $Revision$ -->
3
-

4
3
<refentry xml:id="reflectionproperty.getvalue" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
5
4
<refnamediv>
6
5
<refname>ReflectionProperty::getValue</refname>
...
...
@@ -9,9 +8,9 @@
9
8

10
9
<refsect1 role="description">
11
10
&reftitle.description;
12
-
<methodsynopsis>
11
+
<methodsynopsis role="ReflectionProperty">
13
12
<modifier>public</modifier> <type>mixed</type><methodname>ReflectionProperty::getValue</methodname>
14
-
<methodparam choice="opt"><type>object</type><parameter>object</parameter></methodparam>
13
+
<methodparam choice="opt"><type class="union"><type>object</type><type>null</type></type><parameter>object</parameter><initializer>&null;</initializer></methodparam>
15
14
</methodsynopsis>
16
15
<para>
17
16
Gets the property's value.
...
...
@@ -44,13 +43,36 @@
44
43
</para>
45
44
</refsect1>
46
45

47
-
<refsect1 role="errors">
48
-
&reftitle.errors;
49
-
<para>
50
-
Throws a <classname>ReflectionException</classname> if the property is inaccessible.
51
-
You can make a protected or private property accessible using
52
-
<methodname>ReflectionProperty::setAccessible</methodname>.
53
-
</para>
46
+
<refsect1 role="changelog">
47
+
&reftitle.changelog;
48
+
<informaltable>
49
+
<tgroup cols="2">
50
+
<thead>
51
+
<row>
52
+
<entry>&Version;</entry>
53
+
<entry>&Description;</entry>
54
+
</row>
55
+
</thead>
56
+
<tbody>
57
+
<row>
58
+
<entry>8.1.0</entry>
59
+
<entry>
60
+
Private and protected properties can be accessed by
61
+
<methodname>ReflectionProperty::getValue</methodname> right away.
62
+
Previously, they needed to be made accessible by calling
63
+
<methodname>ReflectionProperty::setAccessible</methodname>; otherwise
64
+
a <classname>ReflectionException</classname> was thrown.
65
+
</entry>
66
+
</row>
67
+
<row>
68
+
<entry>8.0.0</entry>
69
+
<entry>
70
+
<parameter>object</parameter> is nullable now.
71
+
</entry>
72
+
</row>
73
+
</tbody>
74
+
</tgroup>
75
+
</informaltable>
54
76
</refsect1>
55
77

56
78
<refsect1 role="examples">
...
...
@@ -74,7 +96,7 @@ var_dump($reflectionClass->getProperty('staticProperty')->getValue());
74
96
var_dump($reflectionClass->getProperty('property')->getValue(new Foo));
75
97

76
98
$reflectionProperty = $reflectionClass->getProperty('privateProperty');
77
-
$reflectionProperty->setAccessible(true);
99
+
$reflectionProperty->setAccessible(true); // only required prior to PHP 8.1.0
78
100
var_dump($reflectionProperty->getValue(new Foo));
79
101
?>
80
102
]]>
...
...
@@ -104,7 +126,6 @@ string(6) "foofoo"
104
126
</refsect1>
105
127

106
128
</refentry>
107
-

108
129
<!-- Keep this comment at the end of the file
109
130
Local variables:
110
131
mode: sgml
111
132