Closed
Description
Description
There is code that implements behavior other than method declarations:
Methods Behaviour
<?php
trait ExpectsFooMethod
{
abstract public function foo(): string;
}
trait ProvidesFooMethod
{
use ExpectsFooMethod;
public function foo(): string {}
}
final readonly class FooMethodImpl
{
use ProvidesFooMethod;
}
Methods Result
See: https://3v4l.org/O5lIe#v8.4.6
// Nothing: OK
Properties Behaviour
<?php
trait ExpectsFooProperty
{
abstract public string $foo { get; }
}
trait ProvidesFooProperty
{
use ExpectsFooProperty;
public readonly string $foo;
}
final readonly class FooPropertyImpl
{
use ProvidesFooProperty;
}
Properties Result
See: https://3v4l.org/tM9i5#v8.4.6
Fatal error: ProvidesFooProperty and ExpectsFooProperty define the same hooked property ($foo) in the composition of ProvidesFooProperty. Conflict resolution between hooked properties is currently not supported. Class was composed in xxxx.php
PHP Version
PHP 8.4.5 (linux, windows); PHP 8.4.6 (from 3v4l.org)
Operating System
Windows, Ubuntu 20.04, Ubuntu 22.04