[php-src] Issue #8090: ReflectionParameter::isDefaultValueAvailable() returns false negative if next parameter is not optional.

From: Date: Sun, 13 Feb 2022 13:12:30 +0000
Subject: [php-src] Issue #8090: ReflectionParameter::isDefaultValueAvailable() returns false negative if next parameter is not optional.
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-239743@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/8090 Author: pronode ### Description The following code: ```php class Test { public function foo(int $id = 1, string $str = 'default') {} public function goo(int $id = 1, string $str) {} public function moo(int $id = 1) {} } var_dump((new \ReflectionMethod(new Test(), 'foo'))->getParameters()[0]->isDefaultValueAvailable()); var_dump((new \ReflectionMethod(new Test(), 'goo'))->getParameters()[0]->isDefaultValueAvailable()); var_dump((new \ReflectionMethod(new Test(), 'moo'))->getParameters()[0]->isDefaultValueAvailable()); ``` Resulted in this output: ``` bool(true) bool(false) bool(true) ``` But I expected this output instead: ``` bool(true) bool(true) bool(true) ``` ### PHP Version PHP 8.1.1 ### Operating System Windows 10

« previous php.bugs (#239743) next »