> 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.

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

Reply via email to