Final Method In Trait

Trait methods can be named final, when importing them as a trait alias. It was explicitely forbidden until PHP 8.3. This has nothing to do with the final keyword.

PHP code

<?php

trait t {
    function foo() {}
}

trait t2 {
    function foo() {}
}

class A {
        use t, t2 { t::foo as final; }
}
?>

Before


After


PHP version change

This behavior changed in 8.3

Error Messages