Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:92876 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 49427 invoked from network); 28 Apr 2016 17:36:32 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 28 Apr 2016 17:36:32 -0000 Authentication-Results: pb1.pair.com header.from=bobwei9@hotmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=bobwei9@hotmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain hotmail.com designates 65.55.111.140 as permitted sender) X-PHP-List-Original-Sender: bobwei9@hotmail.com X-Host-Fingerprint: 65.55.111.140 blu004-omc4s1.hotmail.com Received: from [65.55.111.140] ([65.55.111.140:57137] helo=BLU004-OMC4S1.hotmail.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 09/34-28296-E1A42275 for ; Thu, 28 Apr 2016 13:36:31 -0400 Received: from BLU436-SMTP98 ([65.55.111.137]) by BLU004-OMC4S1.hotmail.com over TLS secured channel with Microsoft SMTPSVC(7.5.7601.23008); Thu, 28 Apr 2016 10:36:27 -0700 X-TMN: [2CntevfEomVm/Zb31P0xh87d3jI7RiNe] X-Originating-Email: [bobwei9@hotmail.com] Message-ID: Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 (Mac OS X Mail 9.2 \(3112\)) In-Reply-To: Date: Thu, 28 Apr 2016 19:36:22 +0200 CC: Anatol Belski , Joe Watkins , internals , Levi Morrison Content-Transfer-Encoding: quoted-printable References: To: Dmitry Stogov X-Mailer: Apple Mail (2.3112) X-OriginalArrivalTime: 28 Apr 2016 17:36:24.0541 (UTC) FILETIME=[7C6028D0:01D1A174] Subject: Re: [PHP-DEV] Request to withdraw RFC's for nullable types for only return values From: bobwei9@hotmail.com (Bob Weinand) > Am 28.04.2016 um 18:28 schrieb Dmitry Stogov : >=20 > Hi, >=20 > The BC break in PHP-7.0 was introduced by commit = ee9a78a033696ff9546fb1dbfecd28f20477b511=20 >=20 > Author: Joe Watkins > Date: Mon Mar 28 11:54:25 2016 +0100 >=20 > Late, there were few more commits that changed and moved the = problematic code. >=20 > Anatol, I think we should revert this before 7.0.6 release. >=20 > Thanks. Dmitry. >=20 > ________________________________________ > From: morrison.levi@gmail.com on behalf of = Levi Morrison > Sent: Thursday, April 28, 2016 18:40 > To: internals > Cc: Dmitry Stogov; Tom Worster > Subject: Request to withdraw RFC's for nullable types for only return = values >=20 > I have discovered through a [bug report][1] a case where having > explicitly nullable parameters would be of value. >=20 > =20 > interface Foo { > public function bar(array $baz =3D null); > } >=20 > class Hello implements Foo { > public function bar(array $baz =3D array()) {} > } >=20 > ?> >=20 > You can theoretically change the default value in a sub-type, but in > this case moving away from the default value of null breaks because > the subtype no longer permits null. It is important to realize that we > previously *allowed* this behavior since PHP 5.1 but was fixed in > 7.0.6. >=20 > If instead we had nullable types separately from default values of > null this could change to: >=20 > =20 > class Hello implements Foo { > public function bar(array | null $baz =3D []) {} > } >=20 > ?> >=20 > (or a short-form `?array $baz =3D []` if short-form passes) >=20 > This preserves the ability to be null but changes the default value. > Of course, there may be other code changes necessary to future-proof > their code but there current code would now work without having to > rewrite any method bodies (just signatures). >=20 > In light of this I kindly request that RFCs that add nullable types > for only return values be withdrawn. So that [Union Types][2] and > [Nullable Types][3] can go forward unhindered. >=20 >=20 > [1]: https://bugs.php.net/bug.php?id=3D72119 > [2]: https://wiki.php.net/rfc/union_types > [2]: https://wiki.php.net/rfc/nullable_types Hey Dmitry, thanks for reverting=E2=80=A6 but I've seen you had merged just straight up? I assume this was unintentional (as it should definitely remain fixed in = 7.1). Thus I've reverted your changes in master (only) and added an = appropriate NEWS entry there. Thanks, Bob=