Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:103518 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 59187 invoked from network); 27 Nov 2018 20:25:45 -0000 Received: from unknown (HELO poczta.brzuchalski.com) (188.165.245.118) by pb1.pair.com with SMTP; 27 Nov 2018 20:25:45 -0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by poczta.brzuchalski.com (Postfix) with ESMTP id A09F1298423A for ; Tue, 27 Nov 2018 17:49:25 +0100 (CET) Received: from poczta.brzuchalski.com ([127.0.0.1]) by localhost (poczta.brzuchalski.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id cTLPNYOB2zQM for ; Tue, 27 Nov 2018 17:49:20 +0100 (CET) Received: from mail-lj1-f182.google.com (unknown [209.85.208.182]) by poczta.brzuchalski.com (Postfix) with ESMTPSA id 490BD2984236 for ; Tue, 27 Nov 2018 17:49:20 +0100 (CET) Received: by mail-lj1-f182.google.com with SMTP id k19-v6so20666476lji.11 for ; Tue, 27 Nov 2018 08:49:20 -0800 (PST) X-Gm-Message-State: AA+aEWb7H9V8CNsoJ8ZlDIMZYzY1P2ulVxsHHmSGHokMWpxAjbrXcm4K kW0hptzwaPyxWG4qq0UFyyB5KNLjKqpC4VAXp/I= X-Google-Smtp-Source: AFSGD/X3c2uu9Nm7Wij+0VCraiv9mjqOJfupfavr0+jKnd0nCrLA/aPKeIqSWvazM4meFl1tbWMlEDqmSWq6d7YrA3c= X-Received: by 2002:a2e:9b52:: with SMTP id o18-v6mr1930793ljj.108.1543337359649; Tue, 27 Nov 2018 08:49:19 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: Date: Tue, 27 Nov 2018 17:49:07 +0100 X-Gmail-Original-Message-ID: Message-ID: To: Levi Morrison Cc: PHP Internals List Content-Type: multipart/alternative; boundary="0000000000001736de057ba83ba9" Subject: Re: [PHP-DEV] [RFC][Discuss] Covariant return- and contravariant parameter- types From: michal@brzuchalski.com (=?UTF-8?Q?Micha=C5=82_Brzuchalski?=) --0000000000001736de057ba83ba9 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Can't wait for it to happen! Thank you for your work and fixing object type. pon., 26 lis 2018 o 22:26 Levi Morrison napisa=C5=82(a): > I am happy to announce my latest RFC, [Covariant Returns and > Contravariant Parameters][1], is open for discussion. If you do not > recognize those terms then hopefully the introduction coupled with the > [examples][2] will help. Here is one snippet that demonstrates > covariant return types: > > interface Repository { > function fetch(int $id): ?Entity; > } > > class UserFactory implements Repository { > function fetch(int $id): ?UserEntity { > /* Since UserEntity is an Entity, this is now allowed */ > /* ... implementation ... */ > } > } > ?> > > Covariant return types and contravariant parameter types are highly > requested features; here are a few of the bug reports: > > * https://bugs.php.net/bug.php?id=3D71825 > * https://bugs.php.net/bug.php?id=3D72442 > * https://bugs.php.net/bug.php?id=3D75385 > * https://bugs.php.net/bug.php?id=3D75823 > > There is a [preliminary implementation][3] that is available. It will > not be rebased during discussion to allow people to check out the code > and get updates without worrying about it breaking. The code quality > can definitely be improved, and there are still a few todo comments in > the code. > > Please do not discuss the items found in [Future Scope][4] as part of > this thread, which includes discussing types such as `mixed`, > `scalar`, `numeric`, etc. > > I look forward to your feedback, and especially with your > experimentation with the implementation. > > Levi Morrison > > [1]: > https://wiki.php.net/rfc/covariant-returns-and-contravariant-parameters > [2]: > https://wiki.php.net/rfc/covariant-returns-and-contravariant-parameters#e= xamples > [3]: > https://github.com/php/php-src/compare/master...morrisonlevi:variance2 > [4]: > https://wiki.php.net/rfc/covariant-returns-and-contravariant-parameters#f= uture_scope > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > --=20 regards / pozdrawiam, -- Micha=C5=82 Brzuchalski about.me/brzuchal brzuchalski.com --0000000000001736de057ba83ba9--