[php-src] Issue #7912: ReflectionProperty::getDocComment not respect Enum Cases PHPDoc.
| From: | michaljusiega | Date: | Sat, 08 Jan 2022 14:55:16 +0000 |
| Subject: | [php-src] Issue #7912: ReflectionProperty::getDocComment not respect Enum Cases PHPDoc. | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-238875@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/7912
Author: michaljusiega
### Description
The following code:
```php
<?php
enum TestEnum: string {
/** Description about Case. */
case ABC = 'abc';
case XYZ = 'xyz';
/** @var string */
public const QWERTY = 'qwerty';
}
$reflectionClass = new ReflectionClass(TestEnum::class);
var_dump($reflectionClass->getProperties()[0]->getDocComment());
var_dump($reflectionClass->getProperties()[1]->getDocComment());
var_dump($reflectionClass->getReflectionConstants()[0]->getDocComment());
var_dump($reflectionClass->getReflectionConstants()[1]->getDocComment());
var_dump($reflectionClass->getReflectionConstants()[2]->getDocComment());
```
Resulted in this output:
```
bool(false)
bool(false)
string(30) "/** Description about Case. */"
bool(false)
string(18) "/** @var string */"
```
But I expected this output instead:
```
string(30) "/** Description about Case. */"
bool(false)
string(30) "/** Description about Case. */"
bool(false)
string(18) "/** @var string */"
```
The link for 3v4l.org: https://3v4l.org/s1Lru
### PHP Version
PHP 8.1.0
### Operating System
Any