The LSP is about the contract of a class, and that inherited classes must still fulfill the same contract as their base class. An interface just in code will typically only define *parts* of that contract, mainly the syntactical part, and the semantics as far as it is given by descriptive names of the methods. Other parts of the contract are often just defined in comments, by adding "assertion statements", by making use of specific language features, or they might be encoded into unit tests.
Thus if you solved the LSP violation really, depends on the **full semantic contract** of your interface. If the contract looks like this (which is IMHO the more obvious behaviour):
// contract: a four sided shape is an object with two individual, independent
// properties "width" and "height"
interface AFourSidedShape{
public function setWidth($width);
public function setHeight($height);
public function getWidth();
public function getHeight();
}
then `Square` class does not fulfill the same contract as its base class, so it still violates the LSP. One could write that more formally in terms of "post conditions", checking that each time you call `setHeight`, the value of `getWidth` does not change, and vice versa.
If, however, your semantic contract looks like this:
// contract: a four sided shape is an object with two
// properties "width" and "height" which must not
// be assumed to be independent; maybe changing one can change the other
interface AFourSidedShape{
// ...
}
then there is no LSP violation any more. However, the latter does probably violate the [principle of least astonishment][1], and you need to remove the formal post condition from above for this interface.
[1]: https://en.wikipedia.org/wiki/Principle_of_least_astonishment