Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:108009 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 48894 invoked from network); 6 Jan 2020 20:13:09 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 6 Jan 2020 20:13:09 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 188C0180545 for ; Mon, 6 Jan 2020 10:18:07 -0800 (PST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_LOW,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL, SPF_HELO_PASS,SPF_NONE autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS11403 66.111.4.0/24 X-Spam-Virus: No X-Envelope-From: Received: from out2-smtp.messagingengine.com (out2-smtp.messagingengine.com [66.111.4.26]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Mon, 6 Jan 2020 10:18:06 -0800 (PST) Received: from compute7.internal (compute7.nyi.internal [10.202.2.47]) by mailout.nyi.internal (Postfix) with ESMTP id 0F43C21F2E for ; Mon, 6 Jan 2020 13:18:06 -0500 (EST) Received: from imap26 ([10.202.2.76]) by compute7.internal (MEProxy); Mon, 06 Jan 2020 13:18:06 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; bh=TGuI0Q GxYYCWi3N5oT95FCf2hK0cOHleyLpTDuv2LPU=; b=Vp+CpMClBL1Uv5pftY2kLb B9EQ/5eD644e6iOSdqgWUtVo1oDTZn5fvTJrgYtAsFX/Dq6nFsHyStaDP4QR2ody dVjZF9JStoWDbtNRM9zs8teLwfR81T+E6gvO72pa0enG/yguPShfDXif6aS+S1j2 uAPLOcK8+Fs6Ytfu+9tnxyG6rcEjIMchbKf8jHqStVhNRjRHHC/7Hq0Wu4v+HAJf CjugJtLeq3ihv6YTNJMH+xKBvycpfXWVD+9M64BRbLyzI0EPxJtHtt2Of/Ty6KDS 8V4TrdlSOnOTkwqVppNPwiu3LFxe2lY3htmtyE7lrJg6W7/mG57aqOnHa6vMdx1Q == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedufedrvdehtddgudduvdcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpefofgggkfgjfhffhffvufgtsehttdertderreejnecuhfhrohhmpedfnfgr rhhrhicuifgrrhhfihgvlhgufdcuoehlrghrrhihsehgrghrfhhivghlughtvggthhdrtg homheqnecuffhomhgrihhnpehgihhthhhusgdrtghomhenucfrrghrrghmpehmrghilhhf rhhomheplhgrrhhrhiesghgrrhhfihgvlhguthgvtghhrdgtohhmnecuvehluhhsthgvrh fuihiivgeptd X-ME-Proxy: Received: by mailuser.nyi.internal (Postfix, from userid 501) id C8C4C14200A2; Mon, 6 Jan 2020 13:18:05 -0500 (EST) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.1.7-731-g1812a7f-fmstable-20200106v2 Mime-Version: 1.0 Message-ID: <9126e194-fee1-4d54-968c-d964d2e442f3@www.fastmail.com> In-Reply-To: References: Date: Mon, 06 Jan 2020 12:17:44 -0600 To: "php internals" Content-Type: text/plain Subject: =?UTF-8?Q?Re:_[PHP-DEV]_Inconsistent_class_behavior_and_undocumented(=3F?= =?UTF-8?Q?)_BC_change?= From: larry@garfieldtech.com ("Larry Garfield") On Mon, Jan 6, 2020, at 5:16 AM, Nikita Popov wrote: > Others have already explained why constructors are exempted from LSP > checks, so let me reply to your other point... > > I believe that your example should indeed be legal in general and created a > PR to fix this: https://github.com/php/php-src/pull/5059 > > With this change, the variadic argument can replace any number of > non-variadic arguments, as long as it is compatible with them, where > compatibility is, as usual, determined based on type contravariance, as > well as reference passing invariance. Effectively this means that > function(...$args) is compatible with all signatures that do not involve > reference passing. > > Does anyone see any soundness issues with this change? > > Nikita Nifty! Since `func(...$args)` is already a universal caller, that gives us a symmetrical way to defer calls, either to a parent or to a delegated method on a wrapped object. So that means one can implement a pass-through class where most of the methods are: class Wrapper implements Thing { public function thing(...$args) { $this->wrapped->thing(...$args); } } The symmetry appeals to me, even if it means types get caught only at the lower level. One possible question; would this mean bypassing type checks if not delegating? Viz: interface Foo { public function bar(Foo, $f, Baz $b, Beep $e); } class Impl implements Foo { public function bar(...$args) { ... } } $i = new Impl(); // Will this still report a type error, and if so, where/how? // If not, does that become a back-door way to dodge an interface? Is that good? $i->bar('a', 'b', 'c'); --Larry Garfield