Constants In Trait
Trait can define constants, like a class or an interface. Until PHP 8.3, constants cannot be set in traits, and end with a compilation error.
PHP code
<?php
trait T {
const X = 1;
}
class X {
use T;
}
echo X::X;
?>
Before
PHP Fatal error: Traits cannot have constants
After
1
PHP version change
This behavior changed in 8.3.