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]

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: https://www.php.net/unsub.php

Reply via email to