Fix #65011: ReflectionProperty::getDocComment() fails for multiple variable declarations

We add an example to clarify the behavior.

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@345251 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
Christoph Michael Becker 2018-06-30 12:42:20 +00:00
parent ca83ee0d06
commit 1c1b29f597

View file

@ -59,6 +59,38 @@ var_dump($prop->getDocComment());
string(53) "/**
* @var int The length of the string
*/"
]]>
</screen>
</example>
</para>
<para>
<example>
<title>Multiple property declarations</title>
<para>
If multiple property declarations are preceeded by a single doc comment,
the doc comment refers to the first property only.
</para>
<programlisting role="php">
<![CDATA[
<?php
class Foo
{
/** @var string */
public $a, $b;
}
$class = new \ReflectionClass('Foo');
foreach ($class->getProperties() as $property) {
echo $property->getName() . ': ' . var_export($property->getDocComment(), true) . PHP_EOL;
}
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
a: '/** @var string */'
b: false
]]>
</screen>
</example>