On 2025-03-14 16:24, Viktor Khramov wrote:

Hey Juris.

I have a question about this feature.

At the example blow

interface A
{
public function x(Foo $foo);
}

interface B
{
public function x(Bar $foo);
}

class Test implements ?A, ?B
{
}

what would happen if both interfaces existed?

Hi Viktor,

If `A` exists then `?A` is equivalent to `A`.

In your example Test will implement both A and B.

If Test::x() will be incompatible with either A::x() or B::x(), you will end up with an error.

BR,
Juris

Reply via email to