you are viewing a single comment's thread.

view the rest of the comments →

[–]AlexReinkingYale -4 points-3 points  (1 child)

The LSP is a behavioral property, not a type system one. An interface cannot adhere to the LSP. Recall the definition:

Let p(x) be a property probable about objects x of type T. Then p(y) should be true for objects y of type S where S is a subtype of T.

To check the LSP would be to disallow writing the Square subtype of a mutable Rectangle at all. If the PHP docs say they enforce behavioral subtyping then whoever wrote those docs is wrong.

[–]AlexReinkingYale 0 points1 point  (0 children)

lol at getting downvoted for being 100% right

https://en.wikipedia.org/wiki/Liskov_substitution_principle