Closed
Description
Description
The following code:
<?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