On Wednesday, 10 July 2024 at 16:22, Levi Morrison <levi.morri...@datadoghq.com> wrote:
> > Everything considered, I still do not think changing the name of the > > append() method is a good idea, will it hurt adoption in the short term for > > some classes, yes, but I prefer this than having a large part of the > > ecosystem needing to create an alias just for some weird cases. > > > I don't fully understand the issue with aliases. Could you elaborate > on that? Would calling the method instead of direct aliasing avoid > whatever the issue is? I don't think this would solve the issue, as it is not required for a child class that extends said method to call the parent. Let's use a class that extends SplObjectStorage as an example: https://3v4l.org/l913b Our custom class overwrites the behaviour of the contains() method without calling the parent method. As such, the behaviour of isset() becomes incorrect. And even if we make offsetExists() call the contains() method, nothing actually prevents the child class from overwriting the offsetExists() method instead of the contains() one. In which case, the contains() method would still be the original SplObjectStorage one. One could also just extend both methods and have them differ in implementations. I really believe there isn't a good way to solve this problem other than not having any aliases within class methods. Best regards, Gina P. Banyard