Bug #65011 [Opn->Asn]: ReflectionProperty::getDocComment() fails for multiple variable declarations
Edit report at https://bugs.php.net/bug.php?id=65011&edit=1
ID: 65011
Updated by: felipe@php.net
Reported by: benjamin dot morel at gmail dot com
Summary: ReflectionProperty::getDocComment() fails for
multiple variable declarations
-Status: Open
+Status: Assigned
Type: Bug
Package: Reflection related
Operating System: CentOS 6.4
PHP Version: 5.4.16
-Assigned To:
+Assigned To: johannes
Block user comment: N
Private report: N
New Comment:
Johannes, what is your opinion about this suggestion?
Previous Comments:
------------------------------------------------------------------------
[2013-06-11 10:54:07] benjamin dot morel at gmail dot com
Description:
------------
When multiple class properties are declared at once,
ReflectionProperty::getDocComment() only returns the doc comment for the first
one.
I believe that the doc comment applies to all of the properties if they're
declared together, so getDocComment() should return the same value for all of
them, not just the first one.
Test script:
---------------
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;
}
Expected result:
----------------
a: '/** @var string */'
b: '/** @var string */'
Actual result:
--------------
a: '/** @var string */'
b: false
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=65011&edit=1
Thread (3 messages)