Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:92882 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 59509 invoked from network); 28 Apr 2016 17:47:45 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 28 Apr 2016 17:47:45 -0000 Authentication-Results: pb1.pair.com smtp.mail=bobwei9@hotmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=bobwei9@hotmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain hotmail.com designates 65.55.111.163 as permitted sender) X-PHP-List-Original-Sender: bobwei9@hotmail.com X-Host-Fingerprint: 65.55.111.163 blu004-omc4s24.hotmail.com Received: from [65.55.111.163] ([65.55.111.163:55245] helo=BLU004-OMC4S24.hotmail.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 69/86-28296-FBC42275 for ; Thu, 28 Apr 2016 13:47:45 -0400 Received: from BLU436-SMTP221 ([65.55.111.135]) by BLU004-OMC4S24.hotmail.com over TLS secured channel with Microsoft SMTPSVC(7.5.7601.23008); Thu, 28 Apr 2016 10:47:41 -0700 X-TMN: [Iq+WJRo5TytUo2VmuL33p402AVAUW5s3] 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:47:35 +0200 CC: Joe Watkins , Levi Morrison , internals Content-Transfer-Encoding: quoted-printable References: To: Dmitry Stogov X-Mailer: Apple Mail (2.3112) X-OriginalArrivalTime: 28 Apr 2016 17:47:38.0154 (UTC) FILETIME=[0DE158A0:01D1A176] Subject: Re: [PHP-DEV] Re: Request to withdraw RFC's for nullable types for only return values From: bobwei9@hotmail.com (Bob Weinand) > Am 28.04.2016 um 19:28 schrieb Dmitry Stogov : >=20 > hi Joe, >=20 >=20 > No problem, great it's fixed before 7.0.6 release. >=20 > I think this change might be introduced only together with nullable or = union types. >=20 > Otherwise it makes a problem, described by Levi, that doesn't allow = running the same code in PHP-7.0 and 7.1, and even doesn't allow an ease = fix. >=20 >=20 > Thanks. Dmitry. >=20 >=20 > ________________________________ > From: Joe Watkins > Sent: Thursday, April 28, 2016 8:20:12 PM > To: Dmitry Stogov > Cc: Levi Morrison; internals; Tom Worster > Subject: Re: Request to withdraw RFC's for nullable types for only = return values >=20 > Evening Dmitry, >=20 > This was discussed at length with bob, and I think nikita also, it = seemed like a bug fix rather than a feature. >=20 > Happy for it to be moved into 7.1 ... sorry for dropping the ball = there ... >=20 > Cheers > Joe >=20 > On Thu, Apr 28, 2016 at 6:07 PM, Dmitry Stogov = > wrote: > Thanks for catching the BC break. > Fortunately, we didn't release 7.0.6 with this problem. >=20 > I see some sense in introducing that check, but changing behaviour = requires RFC and definitely not allowed in minor versions. >=20 > I'm not going to withdraw = https://wiki.php.net/rfc/nullable_return_types > It doesn't prohibit usage of nullable for arguments, and even sets = additional question. >=20 > Thanks. Dmitry. >=20 > ________________________________________ > From: morrison.levi@gmail.com = > on behalf of = Levi Morrison > > Sent: Thursday, April 28, 2016 6:40:59 PM > 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 >=20 Uhm =E2=80=A6 reading this, it sounds like it was intentional =E2=80=A6 = if yes, then sorry. But it still allows an easy fix, just pass the value explicitly. I think we should leave the fix in 7.1 thus. The bug itself - violating LSP - must be fixed. The only reason why it's = fine in 7.0 is BC. But it definitely MUST be fixed in 7.1. Bob=