Re: [RFC][Vote] Covariant Returns and Contravariant Parameters

From: Date: Thu, 27 Dec 2018 17:48:44 +0000
Subject: Re: [RFC][Vote] Covariant Returns and Contravariant Parameters
References: 1 2 3 4 5 6  Groups: php.internals 
Request: Send a blank email to internals+get-103643@lists.php.net to get a copy of this message
> 2. But this test misses warning > > > <?php > $q = 1; > if ($q) { > class C {} > class D {} > } > > class A { > function bar(C $c) {} > } > class B extends A { > function bar(D $D) { > echo "ok\n"; > } > } > ?> The code detects this as an error but intentionally does not report it because in other cases a warning is already issued and I did not want to re-issue the warning again. I'll dig into this more to see why it is not issued the first time in this case. However, this should *remain* a warning to be consistent with existing code. When a class extends another non-abstract class and there isn't an interface involved then it's only a warning. We should fix this in PHP 8.0 for all cases.

« previous php.internals (#103643) next »