Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:107905 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 51879 invoked from network); 8 Dec 2019 19:45:53 -0000 Received: from unknown (HELO php-smtp3.php.net) (208.43.231.12) by pb1.pair.com with SMTP; 8 Dec 2019 19:45:53 -0000 Received: from php-smtp3.php.net (localhost [127.0.0.1]) by php-smtp3.php.net (Postfix) with ESMTP id F1D612CAEF4 for ; Sun, 8 Dec 2019 09:43:34 -0800 (PST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp3.php.net X-Spam-Level: X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,BODY_8BITS, DKIM_SIGNED,DKIM_VALID,RCVD_IN_DNSWL_LOW,SPF_HELO_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS11403 64.147.123.0/24 X-Spam-Virus: Error (Cannot connect to unix socket '/var/run/clamav/clamd.ctl': connect: Connection refused) Received: from wout5-smtp.messagingengine.com (wout5-smtp.messagingengine.com [64.147.123.21]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by php-smtp3.php.net (Postfix) with ESMTPS for ; Sun, 8 Dec 2019 09:43:33 -0800 (PST) Received: from compute7.internal (compute7.nyi.internal [10.202.2.47]) by mailout.west.internal (Postfix) with ESMTP id 2010B4A9 for ; Sun, 8 Dec 2019 12:43:32 -0500 (EST) Received: from imap26 ([10.202.2.76]) by compute7.internal (MEProxy); Sun, 08 Dec 2019 12:43:32 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding: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=LJn1wIyuztXQWkZs/Bvpn77QZcKLGdWaJy7Jab/AZ cc=; b=iUhbir0XLXlfG/gXPK/UUX9ghZidwHzMfvRr5/+NfCnN5RPD8pkQnwcmJ qG1sk1r8Z3p0zyuLPUMeLoC7jQFg78o8xYThI4vCjdHvrbS87NYhFneD6+ivoRT6 Q5hPM7v12uyUP3Vc+VYdfmHXGrcgUCWYnjfA/R8LZFiqqF3JxUflB/pTjK7APSxf zYmF4vwvSGkqbL2vIc4CtsB47Sa8hWTJjLDspaafnFU9h29fL4i6Mdb05yqvdENq RDvdIkSFBuAM0RGjZg3T6y0Z2BGEpiVNJG8WRGBzHLo9Ctcc51cvwxGnOIwEteNA qz1GGFpwXzCoVHkd0+CbDgTuz1PGQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedufedrudekjedguddthecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpefofgggkfgjfhffhffvufgtgfesthhqredtreerjeenucfhrhhomhepfdfn rghrrhihucfirghrfhhivghlugdfuceolhgrrhhrhiesghgrrhhfihgvlhguthgvtghhrd gtohhmqeenucffohhmrghinhepshhithgvphhoihhnthdrtghomhdpshhtrggtkhgvgigt hhgrnhhgvgdrtghomhenucfrrghrrghmpehmrghilhhfrhhomheplhgrrhhrhiesghgrrh hfihgvlhguthgvtghhrdgtohhmnecuvehluhhsthgvrhfuihiivgeptd X-ME-Proxy: Received: by mailuser.nyi.internal (Postfix, from userid 501) id 65B1414200A1; Sun, 8 Dec 2019 12:43:31 -0500 (EST) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.1.7-612-g13027cc-fmstable-20191203v1 Mime-Version: 1.0 Message-ID: In-Reply-To: <505a71bd-e77f-564b-e5bb-28fcf8697e40@gmail.com> References: <4C8A8CB1-1259-439A-B213-D10D098010A6@newclarity.net> <505a71bd-e77f-564b-e5bb-28fcf8697e40@gmail.com> Date: Sun, 08 Dec 2019 11:43:10 -0600 To: "php internals" Content-Type: text/plain;charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Envelope-From: 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 Sun, Dec 8, 2019, at 10:14 AM, Rowan Tommins wrote: > On 08/12/2019 05:03, Mike Schinkel wrote: > > Hi Larry, > > > >> I am not clear on why __construct() is special in this case; > > I believe that is the Liskok substitution principle at work, and tha= t fact the principle does not apply to constructors. > > > > For reference: > > > > -https://softwareengineering.stackexchange.com/a/302477/9114 > > -https://www.sitepoint.com/constructors-and-the-myth-of-breaking-the= -lsp/ >=20 >=20 > I'm not sure either of those links do a good job explaining why=20 > constructors in particular are special. >=20 > My first thought was "you call them on the class not an instance", but= =20 > that's also true of static methods, and yet this is an error: >=20 > class Ancestor { > =C2=A0=C2=A0=C2=A0 public static function constructMe(int $a, string = $b) { } > } > class Child extends Ancestor { > =C2=A0=C2=A0=C2=A0 public static function constructMe(...$args) { > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 return parent::constructMe= (...$args); > =C2=A0=C2=A0=C2=A0 } > } >=20 > In PHP, it is actually possible to call a static method based on an=20= > instance, using the syntax "$foo::somethingStatic()", so it is=20 > theoretically logical to constrain a set of related classes to have=20= > compatible static methods. But you can also write "new $foo()" to invo= ke=20 > a constructor based on an instance, so that doesn't explain the=20 > difference either. >=20 > The best explanation I can think of is more pragmatic than theoretical= :=20 > it's often useful to have related objects with unrelated constructors,= =20 > so it's useful for the language not to restrict that. I'd be intereste= d=20 > to hear if there's a more fundamental reason, though. I recall constructors being special with interfaces; I didn't consciousl= y realize that *all* inheritance rules were skipped for them. I suppose= in that case it's logical that it is why it is, just disappointing; the= double-splat trick I was trying above is really nifty, but I guess it o= nly works on constructors. Sad elePHPant... --Larry Garfield