Yea, but how's that an improvement over using an interface? On Sun, Mar 12, 2017 at 1:38 AM, Michael Vostrikov < michael.vostri...@gmail.com> wrote:
> > Example with Rectangle and Square IMO is an example of bad naming in this > case. > > I used this example because this is known problem of inheritance. Type > variants solve this problem. Square is a particular case (variant) of > Rectangle. > > > PHP already has horizontal inheritance. They're called traits. How is > this an improvement in anyway? > > Trait is just reusable implementation. I suggest type matching. This is > extension of type hinting. It can be used in all cases where we need to > check if an object matches some criterias before continue operation. It is > a kind of defensive programming and a replacement for many 'if-throw' > constructions. >