Edit report at https://bugs.php.net/bug.php?id=65011&edit=1
ID: 65011 Updated by: [email protected] Reported by: benjamin dot morel at gmail dot com Summary: ReflectionProperty::getDocComment() fails for multiple variable declarations -Status: Assigned +Status: Open Type: Bug Package: Reflection related Operating System: CentOS 6.4 PHP Version: 5.4.16 -Assigned To: johannes +Assigned To: Block user comment: N Private report: N New Comment: i don't think it is the right thing to do. Let's extend through example: class C { /** * foo */ public $foo, /** * bar */ $bar; } if we here take the doc comment from foo for both it becomes weird (ok, the code is weird, tion) taking bar we make the grammar more complex. I'd keep the current way. Previous Comments: ------------------------------------------------------------------------ [2013-06-24 00:14:29] [email protected] Johannes, what is your opinion about this suggestion? ------------------------------------------------------------------------ [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
