2016-11-21 11:00 GMT+01:00 Daniel Morris <dan...@honestempire.com>:

> What happens if the method signature is defined within an interface?


Just the same as for every class. Having other rules for interfaces doesn't
make sense.

Imagine the following example:

interface I { function foo(array $foo); }
class C1 implements I { function foo(array $foo) { /* with your proposal,
we have to keep the type here? */ } }
class C2 extends C2 { function foo($foo) { /* we can suddenly drop the
parameter type now?! */ } }


> I would consider that method signature a contract and one that should not
> be able to be overwritten.
>

Subtypes can always accept more than a parent by the LSP (
https://en.wikipedia.org/wiki/Liskov_substitution_principle)

Regards, Niklas

Reply via email to