On Wed, Feb 4, 2015 at 10:49 AM, Nikita Popov <nikita....@gmail.com> wrote:
> Hi internals!
>
> Currently we do not allow [1] removing a typehint during inheritance. For
> example the following code is not valid:
>
>     interface A {
>         public function method(Typehint $param);
>     }
>     class B implements A {
>         public function method($param);
>     }
>     // Fatal error: Declaration of B::method() must be compatible with
> A::method(Typehint $param)
>
> The above code does *not* constitute an LSP violation, because B::method()
> accepts more inputs than A::method(). However we still forbid it.

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 :]

-Hannes

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to