On Mon, Sep 2, 2019, at 1:03 PM, Andreas Hennings wrote:
> The value of parameter-based polymorphism is for cases where the > calling code wants to handle all parameter types in one call, whereas > the callee has different implementations for different parameter > types. > > This is not the case here: The calling code does always know whether a > call should be static or not, so it can choose the applicable method > name. This is what I don't get. How can it not? If a method is static-safe, and you want to call it from both static and object contexts... Make it a static method and call it statically from both contexts. That's fine. If it's not safe to call from a static context (because it reads $this), you couldn't call it statically anyway. If the method has 2 different logic paths, depending on if it's a static or object context, then it should be two different methods. Folding them into one just pushes more conditionals down deeper into the code where the cyclomatic complexity impact is greater. That's not a win. --Larry Garfield -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php