[php-src] Issue #12854: 8.3 - as final trait-used method does not correctly report visibility in Reflection

From: Date: Sat, 02 Dec 2023 20:51:38 +0000
Subject: [php-src] Issue #12854: 8.3 - as final trait-used method does not correctly report visibility in Reflection
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-245960@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/12854 Author: ondrejmirtes ### Description The following code: ```php <?php trait SimpleTrait { private function foo() {} } class TraitFixtureWithFinal { use SimpleTrait { foo as final; } } $rm = new ReflectionMethod(TraitFixtureWithFinal::class, 'foo'); var_dump($rm->isFinal()); var_dump($rm->isPrivate()); var_dump($rm->isPublic()); var_dump($rm->isProtected()); ``` Resulted in this output: ``` bool(true) bool(false) bool(false) bool(false) ``` But I expected this output instead: ``` bool(true) bool(true) bool(false) bool(false) ``` Alternatively, a syntax resulting in "final private" class method should be rejected because normally they're not allowed. But the same bug applies to "protected" method - isProtected in ReflectionMethod is also false: https://3v4l.org/0PZvm#v8.3.0 ### PHP Version PHP 8.3 ### Operating System _No response_

« previous php.bugs (#245960) next »