[php-src] Issue #12855: 8.3 - cannot set finality and visibility for method from trait at the same time
| From: | ondrejmirtes | Date: | Sat, 02 Dec 2023 20:54:32 +0000 |
| Subject: | [php-src] Issue #12855: 8.3 - cannot set finality and visibility for method from trait at the same time | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-245961@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/12855
Author: ondrejmirtes
### Description
The following code:
```php
<?php
trait SimpleTrait
{
private function foo() {}
}
class TraitFixtureWithFinalAndProtected
{
use SimpleTrait {
foo as final protected;
}
}
$rm = new ReflectionMethod(TraitFixtureWithFinalAndProtected::class, 'foo');
var_dump($rm->isFinal());
var_dump($rm->isPrivate());
var_dump($rm->isProtected());
var_dump($rm->isPublic());
```
Resulted in this output:
```
bool(false)
bool(true)
bool(false)
bool(false)
```
But I expected this output instead:
```
bool(true)
bool(false)
bool(true)
bool(false)
```
Looks like
as final protected is completely ignored, does not change the method but
does not throw an error either.
Related to: https://github.com/php/php-src/issues/12854
### PHP Version
PHP 8.3
### Operating System
_No response_