Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:103519 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 77674 invoked from network); 27 Nov 2018 22:02:42 -0000 Received: from unknown (HELO mail-it1-f181.google.com) (209.85.166.181) by pb1.pair.com with SMTP; 27 Nov 2018 22:02:42 -0000 Received: by mail-it1-f181.google.com with SMTP id h65so26869ith.3 for ; Tue, 27 Nov 2018 10:26:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=tvVe6jfq/7f8a+U+sZVTGy1ZRyZBeccWmkek3CQ9bQk=; b=j7xaPh7BU2+YufjrAB/2kUqmXVGZdlNAqEXjyk5KsOWOyM9s7y72n+3///u9hzGeY/ +efcaKtSwYTSa6kxWS4L6em0CNQfD0I9eIRHTZGuxc6L0toj9qmDSqCwgt2x93u8gzUC 4gUVQB7ilji39CCfyruNOwpXZa8TB2TTT8Jt3lRl3UVxL0NGHVBJtKc3qmCJGSP23myO lXtjyjvaurj3jEIzTe8mxTRuIbylN9C8fQmWjbfebt857zA5YOOQqxdyHttBEt1MjGkM /2cIa5Y+ZfYGDOr9YROaR52VzzRV0mBcT7LkLUw0j2urKurrwciNNqxK3JEUqkTZyXx0 yS6Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=tvVe6jfq/7f8a+U+sZVTGy1ZRyZBeccWmkek3CQ9bQk=; b=fdyHQAyy6Fb8F75DGVEqnsZCrDsyyy52GjsGj2Qad0/7CeNUSjSK5x1MHMvv/gbS60 174nkbg9oeJWNLjn1R09a6OsAF6dL+AzFEEg7tXVPhgB7tYCtiq0PiEpQ6J2Q1oP1san MCAxCWn4onV7QC+vo6f7gpzBlQZ3qsP4Y/2UMR5JxV1WvCytzjriu7nNe9ubbv1GaPSO uAWhxn9vwcMYneoxGgUNRJ2k+NgyUjO0esglBfUlSRHCsJJI1V/EAjdQ48IZEd7FWHE7 lt1seYxneif31SQkicrrZGjkYSz7zFIZm/N8rXHjFMpwEP3qn9esUa9jwHJWjRiVwOJ7 tTbg== X-Gm-Message-State: AA+aEWaBVmTugzwETUslafXh8gn/c0KMNizsqQ5FyWHH+sab2K9g0bdn mSq1kPszq8ijLMFNdVgGmRkraXggdpDfNLOwJJnMOw== X-Google-Smtp-Source: AFSGD/UiP8257nXGAfhB+gUUSIkm10QZMeu6P8IZNTJTTLOmrRrLAq6fQWwJUqdXktV/V1vUkmQZA2xerwgSFBUZHAo= X-Received: by 2002:a24:b009:: with SMTP id d9-v6mr2327itf.166.1543343183468; Tue, 27 Nov 2018 10:26:23 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: Date: Tue, 27 Nov 2018 19:26:09 +0100 Message-ID: To: levim@php.net Cc: PHP Internals Content-Type: multipart/alternative; boundary="000000000000379fd3057ba99692" Subject: Re: [PHP-DEV] [RFC][Discuss] Covariant return- and contravariant parameter- types From: benjamin.morel@gmail.com (Benjamin Morel) --000000000000379fd3057ba99692 Content-Type: text/plain; charset="UTF-8" I can only say that I've been waiting for this feature for years and am really looking forward to see it implemented, hopefully in 7.4. Good job on the RFC, I wish you luck! On Mon, 26 Nov 2018 at 22:26, Levi Morrison wrote: > 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=71825 > * https://bugs.php.net/bug.php?id=72442 > * https://bugs.php.net/bug.php?id=75385 > * https://bugs.php.net/bug.php?id=75823 > > 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#examples > [3]: > https://github.com/php/php-src/compare/master...morrisonlevi:variance2 > [4]: > https://wiki.php.net/rfc/covariant-returns-and-contravariant-parameters#future_scope > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > --000000000000379fd3057ba99692--