reference/reflection/reflectionproperty/getdoccomment.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.getdoccomment" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
5
4
<refnamediv>
6
5
<refname>ReflectionProperty::getDocComment</refname>
...
...
@@ -9,9 +8,9 @@
9
8

10
9
<refsect1 role="description">
11
10
&reftitle.description;
12
-
<methodsynopsis>
13
-
<modifier>public</modifier> <type>string</type><methodname>ReflectionProperty::getDocComment</methodname>
14
-
<void />
11
+
<methodsynopsis role="ReflectionProperty">
12
+
<modifier>public</modifier> <type class="union"><type>string</type><type>false</type></type><methodname>ReflectionProperty::getDocComment</methodname>
13
+
<void/>
15
14
</methodsynopsis>
16
15
<para>
17
16
Gets the doc comment for a property.
...
...
@@ -26,7 +25,7 @@
26
25
<refsect1 role="returnvalues">
27
26
&reftitle.returnvalues;
28
27
<para>
29
-
The property doc comment.
28
+
The doc comment if it exists, otherwise &false;.
30
29
</para>
31
30
</refsect1>
32
31

...
...
@@ -63,6 +62,38 @@ string(53) "/**
63
62
</screen>
64
63
</example>
65
64
</para>
65
+

66
+
<para>
67
+
<example>
68
+
<title>Multiple property declarations</title>
69
+
<para>
70
+
If multiple property declarations are preceeded by a single doc comment,
71
+
the doc comment refers to the first property only.
72
+
</para>
73
+
<programlisting role="php">
74
+
<![CDATA[
75
+
<?php
76
+
class Foo
77
+
{
78
+
/** @var string */
79
+
public $a, $b;
80
+
}
81
+
$class = new \ReflectionClass('Foo');
82
+
foreach ($class->getProperties() as $property) {
83
+
echo $property->getName() . ': ' . var_export($property->getDocComment(), true) . PHP_EOL;
84
+
}
85
+
?>
86
+
]]>
87
+
</programlisting>
88
+
&example.outputs;
89
+
<screen>
90
+
<![CDATA[
91
+
a: '/** @var string */'
92
+
b: false
93
+
]]>
94
+
</screen>
95
+
</example>
96
+
</para>
66
97
</refsect1>
67
98

68
99
<refsect1 role="seealso">
...
...
@@ -77,7 +108,6 @@ string(53) "/**
77
108
</refsect1>
78
109

79
110
</refentry>
80
-

81
111
<!-- Keep this comment at the end of the file
82
112
Local variables:
83
113
mode: sgml
84
114