Re: Allow dropping typehints during inheritance

From: Date: Thu, 05 Feb 2015 01:08:13 +0000
Subject: Re: Allow dropping typehints during inheritance
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-81852@lists.php.net to get a copy of this message
Hi Hannes, > On 4 Feb 2015, at 23:58, Hannes Magnusson <hannes.magnusson@gmail.com> wrote: > > So what it supports "more inputs"? > It does constitute an LSP violation. "more inputs" is not what the > guarantee is at all, if that is what you want you'd typehint on a > interface. > > > It is a LSP failure to allow a string, or any other scalar value, when > the parent requires a specific type/object. > > It sucks that we fail our arginfo very frequently, but this is the way it is :] An interface requires only a minimum standard for accepted input. If a class implementing that interface allows a wider range of values, but still allows at least what the interface requires it to, it is not an LSP violation. Scalars are not special. -- Andrea Faulds http://ajf.me/

« previous php.internals (#81852) next »