[php-src] Issue #10086: ReflectionProperty::getDefaultValue in php8.1 not working properly when there are > 1 params specified.
| From: | quyle92 | Date: | Mon, 12 Dec 2022 06:06:18 +0000 |
| Subject: | [php-src] Issue #10086: ReflectionProperty::getDefaultValue in php8.1 not working properly when there are > 1 params specified. | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-243104@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/10086
Author: quyle92
### Description
The following code:
```php
class Company
{
public function __construct(public ?int $id = 1, public string $name)
{
}
}
$A = new \ReflectionClass('Company');
$defaultVal =
$A->getMethod('__construct')->getParameters()[0]->isDefaultValueAvailable();
var_dump($defaultVal);
<?php
```
Resulted in this output:
```
false
```
But I expected this output instead:
```
true
```
### PHP Version
PHP 8.1.13
### Operating System
MacOS Monterey