Re: [RFC] Interface Default Methods

From: Date: Mon, 19 Jun 2023 20:53:09 +0000
Subject: Re: [RFC] Interface Default Methods
References: 1 2 3 4  Groups: php.internals 
Request: Send a blank email to internals+get-120625@lists.php.net to get a copy of this message
On 19/06/2023 20:20, David Gebler wrote:
Okay, thanks. That's really quite significant, since it changes the feature to one which could allow changes made to interfaces to adversely impact existing clients of an interface without those clients changing a thing.
As the RFC says, it introduces a form of multiple inheritance, and inheritance in PHP doesn't make any such guarantee - to adapt your example: class A {
    public function foo(): void {
        $this->bar();
    }
} class B extends A {
    public function bar(): void {
        ...
    }
} The job of detecting that class A doesn't define a contract for method bar falls to static analysers, and the same would be true for default implementations on interfaces. Regards, -- Rowan Tommins [IMSoP]

« previous php.internals (#120625) next »