Description
The following code:
trait someTrait
{
protected array $attributes = [];
}
class test
{
use someTrait;
public function __construct(
protected array $attributes = []
) {}
}
$test = new test([1,2,3]);
Resulted in this output:
Fatal error: test and someTrait define the same property ($attributes) in the composition of test. However, the definition differs and is considered incompatible. Class was composed in test.php on line 11
But I expected this output instead:
P.S. If the property is defined outside the constructor, everything works fine!
PHP Version
PHP 8.3.4
Operating System
Windows 11