Remove LSP checks on static methods?
| From: | Mike Schinkel | Date: | Tue, 16 Jun 2020 06:59:22 +0000 |
| Subject: | Remove LSP checks on static methods? | ||
| Groups: | php.internals | ||
| Request: | Send a blank email to internals+get-110562@lists.php.net to get a copy of this message | ||
Hi internals,
Given that there appears to be some appetite to reduce checks for inappropriate signatures[1] I am
wondering if anyone has strong opinions — pro or con — on removing checks for static methods?
My primary use-case where I would like to see checked relaxed is for static methods used as factory
methods[2].
Per [3] it seems that all but the least upvoted answer argues that LSP applies to instances, not
static methods.
Per [4] it seems that all upvoted answers agree that constructors should not be constrained by LSP,
and since a factory method is a form of a constructor it would seem that if constructors do not
require LSP then factory methods would not either.
Does anyone see any issues with relaxing these checks for static methods that would have them
downvote an RFC on the topic?
Thank you in advance.
-Mike
[1] https://wiki.php.net/rfc/inheritance_private_methods
[2] https://en.wikipedia.org/wiki/Factory_method_pattern#:~:text=The%20Factory%20Method%20design%20pattern%20is%20used%20by%20first%20defining,of%20objects%20the%20parent%20contains.
[3] https://softwareengineering.stackexchange.com/questions/101102/are-static-classes-with-static-methods-considered-solid
[4] https://stackoverflow.com/questions/5490824/should-constructors-comply-with-the-liskov-substitution-principle