Re: [PHP-DEV] PHP's support to contravariance and covariance

2017-01-31 Thread Marco Pivetta
On 1 Feb 2017 12:27 a.m., "Christoph M. Becker" wrote: On 31.01.2017 at 21:47, Levi Morrison wrote: >> Is there anything else that I am missing? > > Sadly, yes. Consider the following snippet: > > class A { > function method(): B; > } > > class B extends A { > functio

Re: [PHP-DEV] PHP's support to contravariance and covariance

2017-01-31 Thread Christoph M. Becker
On 31.01.2017 at 21:47, Levi Morrison wrote: >> Is there anything else that I am missing? > > Sadly, yes. Consider the following snippet: > > class A { > function method(): B; > } > > class B extends A { > function method(): C; > } > > class C extends B {} >

Re: [PHP-DEV] PHP's support to contravariance and covariance

2017-01-31 Thread Levi Morrison
> Is there anything else that I am missing? Sadly, yes. Consider the following snippet: class A { function method(): B; } class B extends A { function method(): C; } class C extends B {} When checking that B::method satisfies the requirements of A::method it

Re: [PHP-DEV] PHP's support to contravariance and covariance

2017-01-31 Thread Rasmus Schultz
We were talking about this exact issue at work today. Supporting this for interfaces would be particularly useful - if an implementation better than satisfies the requirements defined by an interface, it should be able to implement that interface. I'd be very happy to see an RFC for this :-) On