[RFC][DISCUSSION] Allow abstract function override

php.internals

Net Mo

9 years ago
Hello internals, I've just created a new RFC, you can read it at: https://wiki.php.net/rfc/allow-abstract-function-override Note: I have absolutely no idea how difficult implementing this would be, as I have no C/internals knowledge. Thus, patches are very welcome - thank you in advance if you intend to work on it! Regards, Wes

Marco Pivetta

9 years ago
An abstract function is a partial interface: I see no value in adding exceptions to interface implementations, especially if you add that: * only works with abstract classes, not interfaces * has a too narrow use-case scenario (need more necessity and scenarios with common patterns) * just write a different interface if it doesn't match what you are doing * if an abstract class doesn't fit your scenario, just don't extend from it * proxying would cause calls to the same methods anyway (on a parent class or a delegate instance), so parameter and return types should match exactly, or else you incur in type-juggling-hell (the proxy example is moot) On 1 Mar 2017 3:21 a.m., "Wes" <netmo.php@gmail.com> wrote:

Net Mo

9 years ago
Not sure i get what you mean. With "abstract functions" I include also those in interfaces. I haven't tried 7.2 yet, but i think what I'm proposing is already supported (+ kelunik's RFC): ``` interface A{ function x(stdClass $foo); } interface B extends A{ function x($foo): stdClass; } ``` I want this supported by abstract functions in abstract classes too.