Re: Parameter type widening RFC

From: Date: Thu, 25 May 2017 16:38:08 +0000
Subject: Re: Parameter type widening RFC
References: 1 2 3 4  Groups: php.internals 
Request: Send a blank email to internals+get-99180@lists.php.net to get a copy of this message
Hi Marco, On Thu, May 25, 2017 at 6:58 PM, Marco Pivetta <ocramius@gmail.com> wrote: > On Thu, May 25, 2017 at 4:30 PM, Andrey Andreev <narf@devilix.net> wrote: >> >> I'm trying, but fail to find a source that says replacing stdClass >> with mixed/any/etc is ok. > > > It is OK for a subtype to handle a wider range of types than its contract, > it is not ok for the subtype to handle a smaller range of types than its > contract. > > A contract says what you "must" be able to do to satisfy it, so the > invariants hold. > Sorry, but by "source" I didn't mean somebody state it here. :) When I said I don't claim to fully understand LSP, I didn't mean "tell me what it is" - I'm familiar with it. What I don't understand is how do we get from this: > Wikipedia: > > an object of type T may be substituted with any object of a subtype S To this: > A single type may be substituted by any other type Cheers, Andrey.

« previous php.internals (#99180) next »