|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2013-06-11 10:54 UTC] 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
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Dec 02 19:00:01 2025 UTC |
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.