Re: [RFC] [Discussion] Optional interfaces
| From: | Juris Evertovskis | Date: | Fri, 14 Mar 2025 17:05:12 +0000 |
| Subject: | Re: [RFC] [Discussion] Optional interfaces | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-126757@lists.php.net to get a copy of this message | ||
On 2025-03-14 16:24, Viktor Khramov wrote:
Hey Juris. I have a question about this feature. At the example blowHi Viktor, Ifinterface 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?
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