Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:113537 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 41657 invoked from network); 15 Mar 2021 13:42:47 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 15 Mar 2021 13:42:47 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id A2D9D180504 for ; Mon, 15 Mar 2021 06:36:18 -0700 (PDT) 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.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,HTML_MESSAGE, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from mail-lj1-f178.google.com (mail-lj1-f178.google.com [209.85.208.178]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Mon, 15 Mar 2021 06:36:17 -0700 (PDT) Received: by mail-lj1-f178.google.com with SMTP id a1so16231928ljp.2 for ; Mon, 15 Mar 2021 06:36:17 -0700 (PDT) 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=haKpkeTpDAc4Hm1v8qNR5yub/UPquOmODrwMjX8+sl8=; b=D22fASLdCpShrNun9JhUnHyllGd4egIc28llZlBQDU8f/72joDyThIwo5VbQy0BFKO NTfcmOoq5U6S6E2g0T2pi++ygKRpMUc9xSSbOTDoiGXjhYX9cIYfnCxFhKD0hOwYJgva TTwdv9+eqEVthkbUUeW15PxT2+rqe9pWo50JpkSdyPO+dPAcEZsV/IwCT39JbLW9y9ly Nh0YF9u49fm3DLIUAYnsNQ7idyCS3+rtukB8LdYfDzW0t7z77yx9qlZMkPRUMnm8UXOO 1tRg5pvbhjy2hbN8YefInlTeSMxdB1UZnOwlvqZlbtK/boDUwod8V7R2JeOKUtlv6E0Z wL/g== 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=haKpkeTpDAc4Hm1v8qNR5yub/UPquOmODrwMjX8+sl8=; b=mgOHSOVdHmR9BeT5ymKPGy1oQICgOwFaWdI3tBeQ1t8n54a/Ext1I6dWbG7DuCrofA j/EgOSwuWnlwTab4Tp2VcofgOAzvFdQP9bSa4Zg9DU5KD+sR8kCXmgLJpib4fxElGwIW xBe6xiEkQ6r6zB3cix4KulilcOanarenofy3qwFV69w92VwDiytG2g4p/9JAROS1PXUF 9Z2LYbmgyoSNkRAgVaJkbJhUSYip6zKLBPOqR2FDmeysZG8tV8IxrsUdXF2ChwfFGZju +bfdipE2IRL6IqP9pa+hxkb5mDvzqN9pWYER66WJsowjO36RmncAHrvkATneRakJ85Fw mqNA== X-Gm-Message-State: AOAM533/3LWK/74JnfKLjS9S79BnPYOeanCZiN8v0RSJppT1+415dcqb 8m2/EAsQFClad3810fpF9o2t9aG03iCjkFnLUYo= X-Google-Smtp-Source: ABdhPJyuAyGlvz9odzsNKdny5hTsSpItmSpJrkPlwmkzGraOm44WXrRLhwudiRM5ME/tl+1JqgDG1TUaJInNFUXWqDg= X-Received: by 2002:a2e:99ce:: with SMTP id l14mr10945084ljj.93.1615815376409; Mon, 15 Mar 2021 06:36:16 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Date: Mon, 15 Mar 2021 14:35:59 +0100 Message-ID: To: Matthew Brown Cc: Rowan Tommins , Internals Content-Type: multipart/alternative; boundary="0000000000008899f805bd93554a" Subject: Re: [PHP-DEV] [RFC Proposal] Allow methods to 'become' static From: nikita.ppv@gmail.com (Nikita Popov) --0000000000008899f805bd93554a Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Mon, Mar 15, 2021 at 2:16 PM Matthew Brown wrote: > On Sun, 14 Mar 2021 at 18:09, Rowan Tommins > wrote: > > > Are you saying that having the parent::getSomeInt() call fail would be > > problematic? > > > > > Yes, that's where this becomes unsound =E2=80=93 you can call the child = method > statically, but the parent call assumes a dynamic instance. > > This is just my perspective (as someone building a tool that helps preven= t > people from shooting themselves in the foot), but PHP should not allow > _more_ unsound behaviour than it already does. > I'm not sure I follow your point. The fact that something is compatible, does not mean that you can just blindly perform a forwarding call. For example, consider this: class A { public function method(string $x) {} } class B extends A { public function method(string|int $x) { parent::method($x); } } B::method() is compatible with A::method() from a typesystem perspective. But that doesn't mean that a parent::method() call will work. The above code is simply an implementation bug in B::method(), but doesn't say anything fundamental about the compatibility of the signatures. I would argue that the same holds in your example. Disclaimer: I have some serious doubts that allowing non-static->static changes is worthwhile, I just don't see why it would be outright unsound. Regards, Nikita --0000000000008899f805bd93554a--