[php-src] Issue #20895: ReflectionProperty does not return the PHPDoc of a property if it contains an attribute with a Closure
[email protected] (zavarock)
| Newsgroups | php.bugs |
|---|---|
| Message-ID | <[email protected]> |
Issue: https://github.com/php/php-src/issues/20895
Author: zavarock
### Description
The following code:
```php
<?php
#[\Attribute(\Attribute::TARGET_PROPERTY)]
class Hello {
public function __construct(
public Closure $world,
) {
}
}
class Foo {
/**
* @var string
*/
#[Hello(static function() {
return null;
})]
public $bar;
}
$reflectionProperty = new ReflectionProperty(Foo::class, 'bar');
var_dump($reflectionProperty->getDocComment());
```
Resulted in this output:
```
bool(false)
```
But I expected this output instead:
```
string(30) "/** * @var string */"
```
### PHP Version
```plain
PHP 8.5.0
```
### Operating System
_No response_