Re: [RFC][Vote] Covariant Returns and Contravariant Parameters
| From: | Levi Morrison | Date: | Fri, 04 Jan 2019 19:17:22 +0000 |
| Subject: | Re: [RFC][Vote] Covariant Returns and Contravariant Parameters | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-103683@lists.php.net to get a copy of this message | ||
On Thu, Jan 3, 2019 at 8:28 AM Levi Morrison <levim@php.net> wrote:
>
> On Wed, Dec 19, 2018 at 4:10 PM Levi Morrison <levim@php.net> wrote:
> >
> > Thank you for the feedback and discussion on the [Covariant Returns
> > and Contravariant Parameters RFC][1].
> >
> > I have opened [voting on this RFC][2]. Given that this is a common
> > time for holidays for many people around the world it will be open
> > until at least January 2nd. Happy holidays!
> >
> > [1]:
> > https://wiki.php.net/rfc/covariant-returns-and-contravariant-parameters
> > [2]:
> > https://wiki.php.net/rfc/covariant-returns-and-contravariant-parameters#voting
>
> Currently there are 31 yes votes, and only 1 no vote. I will leave the
> vote open for a few more days while I examine an issue that Dmitry
> mentioned here on the list. When we have code like the following, no
> errors or warnings are generated but there should be a warning:
>
> <?php
> class A {}
> class X {
> function m(A $z) {}
> }
> class Y extends X {
> function m(NotAnA $z) {}
> }
> ?>
>
> I am intentionally not generating a warning at runtime for some cases.
> The engine already issues a warning at compile time for some similar
> cases and I didn't want to duplicate the warning at runtime.
> Apparently this code is not precise enough.
I have a new pull request:
https://github.com/php/php-src/pull/3732
This fixes all currently known issues with the implementation,
including the snippet from my last message. There are a few todo items
left that may have issues, but so far we haven't hit those cases in
any code.
I intend to close the vote in a day or two, unless I hear of new
issues from Dmitry or others.