From:             benjamin dot morel at gmail dot com
Operating system: CentOS 6.4
PHP version:      5.4.16
Package:          Reflection related
Bug Type:         Bug
Bug description:ReflectionProperty::getDocComment() fails for multiple variable 
declarations

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 bug report at https://bugs.php.net/bug.php?id=65011&edit=1
-- 
Try a snapshot (PHP 5.4):   
https://bugs.php.net/fix.php?id=65011&r=trysnapshot54
Try a snapshot (PHP 5.3):   
https://bugs.php.net/fix.php?id=65011&r=trysnapshot53
Try a snapshot (trunk):     
https://bugs.php.net/fix.php?id=65011&r=trysnapshottrunk
Fixed in SVN:               https://bugs.php.net/fix.php?id=65011&r=fixed
Fixed in release:           https://bugs.php.net/fix.php?id=65011&r=alreadyfixed
Need backtrace:             https://bugs.php.net/fix.php?id=65011&r=needtrace
Need Reproduce Script:      https://bugs.php.net/fix.php?id=65011&r=needscript
Try newer version:          https://bugs.php.net/fix.php?id=65011&r=oldversion
Not developer issue:        https://bugs.php.net/fix.php?id=65011&r=support
Expected behavior:          https://bugs.php.net/fix.php?id=65011&r=notwrong
Not enough info:            
https://bugs.php.net/fix.php?id=65011&r=notenoughinfo
Submitted twice:            
https://bugs.php.net/fix.php?id=65011&r=submittedtwice
register_globals:           https://bugs.php.net/fix.php?id=65011&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=65011&r=php4
Daylight Savings:           https://bugs.php.net/fix.php?id=65011&r=dst
IIS Stability:              https://bugs.php.net/fix.php?id=65011&r=isapi
Install GNU Sed:            https://bugs.php.net/fix.php?id=65011&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=65011&r=float
No Zend Extensions:         https://bugs.php.net/fix.php?id=65011&r=nozend
MySQL Configuration Error:  https://bugs.php.net/fix.php?id=65011&r=mysqlcfg

Reply via email to