mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-16 00:48:54 +00:00
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:
parent
ca83ee0d06
commit
1c1b29f597
1 changed files with 32 additions and 0 deletions
|
@ -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>
|
||||
|
|
Loading…
Reference in a new issue