Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:103512 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 39058 invoked from network); 27 Nov 2018 01:09:09 -0000 Received: from unknown (HELO mail-ot1-f41.google.com) (209.85.210.41) by pb1.pair.com with SMTP; 27 Nov 2018 01:09:09 -0000 Received: by mail-ot1-f41.google.com with SMTP id f18so16528211otl.11 for ; Mon, 26 Nov 2018 13:32:37 -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=xJl2dCh9emxRSMPi4EgI129Uy6Nn6McggNgWkxcr41U=; b=GVYP9ENEXU4Yezl/Hfk3zzdRaiW6ri+p0UZbyxyEeZ6zNIWUbhwRdRMj7jmK2gskOY Nd7qeRP35yvht82/vTHNmbV4dr1Rs98dl3KKCCPqoh9GCXPGq3ujTtMJeoNuIVL8ySNP FaBnBpH6//heDCuXE1kEukCVDqnUB2nNWAlPDgzWnxxDfp1a/+odfHIG7xmTkBodDkSX WLmTqsmu/sW1qFXS3Lc8laFJ55PQFl+r7V4cf8+K37r0VhJcUT191v418PAbBuqO/Vkb x+FRSipX5ZQgFAVbAFOiQPfTXMh6iY1nT4+R27MoDhlIrvnKiJ/U/21W3V/N7x8aJufH 2vog== 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=xJl2dCh9emxRSMPi4EgI129Uy6Nn6McggNgWkxcr41U=; b=fTqH7NYa0FWsiqZotMdwqC+JSCflrdr2fYbGHvvkUa66IiZfGv8KoYr1POxegnjH8u rSIlBEOK06F01pyNLEHQ7XbaHGDVNxv7l49qIOzZwHHVwjSYiVi9kPUeBR/YAZ/8O8wb ePn1VGroMBUjdUGFCEzXGr6QYykk7rpbrIUFxg6baDqgNrZGQVu/seDq13Emps0CBf0e 3y92Y4ZNQQrYp4Fkyfks32Gh0fH/8xkgw7SRlcTSo3nE7lzug2ACmG++I1zLhIz7d/e6 FbpR7naNBKREgHtsXEsoeLNx+XjWpL2t6gDT9dg0wcCQ2Qbnzrk90EwWlwVdO+q9BR5j Y8ww== X-Gm-Message-State: AA+aEWZM+wmfzi8jPyz2mNefEDbDu2SCQ1ooCmuRu2K8NCH6cKMq83/2 zZ+U1TTVIVwZs8sFuA6uoaNQQAu6Pc8BP7/bmXNgCs/I X-Google-Smtp-Source: AFSGD/UmE+9jQkKwBOEihuVqWT8dfYPkm3jg684UJEFaSRVdhmKCdZmL534BaaZNZp/1ivgWxJw/rt94R3o9vzXYee8= X-Received: by 2002:a9d:52a0:: with SMTP id f32mr13572313oth.6.1543267956623; Mon, 26 Nov 2018 13:32:36 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: Date: Mon, 26 Nov 2018 19:32:25 -0200 Message-ID: To: Levi Morrison Cc: internals Content-Type: multipart/alternative; boundary="000000000000590e35057b98120b" Subject: Re: [PHP-DEV] [RFC][Discuss] Covariant return- and contravariant parameter- types From: marcospassos.com@gmail.com (Marcos Passos) --000000000000590e35057b98120b Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable I'm waiting for it for a long time! Thank you for putting effort on this! Em seg, 26 de nov de 2018 =C3=A0s 19:26, Levi Morrison escr= eveu: > 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 > > --000000000000590e35057b98120b--