Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:110564 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 48461 invoked from network); 16 Jun 2020 09:05:09 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 16 Jun 2020 09:05:09 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id E0E961804E1 for ; Tue, 16 Jun 2020 00:50:31 -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=-0.2 required=5.0 tests=BAYES_40,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-ASN: AS15169 209.85.128.0/17 X-Spam-Virus: No X-Envelope-From: Received: from mail-lj1-f176.google.com (mail-lj1-f176.google.com [209.85.208.176]) (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 ; Tue, 16 Jun 2020 00:50:31 -0700 (PDT) Received: by mail-lj1-f176.google.com with SMTP id 9so22303171ljv.5 for ; Tue, 16 Jun 2020 00:50:31 -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=OgNxV9sv5KNXjzaJ87ZoZbmgFtOopxYk//sTmcp/QJA=; b=UstzHlHTfYudbYgZtxJbObUyg8JEf7v32OUjgK7nZkdx2q5IcYrq6+Nc5G3HPnl+Ao Gw7e7/9lMclPMCrN+6PNUBMGFZfxcFql1TMT+sc4NfYNHDGBFdqA3hnAHJ4+1fCcMThY oRtXY3mTVpMB6/kqUF3ou0EIPXS4bKwgT8mgRUivA/uiRo9wv8D1vOXErqhzeTLu36IR 8uNMsArjISoUO0Pc/QrB+0ErL305rrP8HSq0lTEZPZm5UMfQEaSiWWhNyip9uQWku/5w ywRCwNcwv1OGJN+++7zRibbBzSGWWCRCM1gdgRrBEVtsOMQdvwug1VcsCtc5AmqfTDwc sYFw== 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=OgNxV9sv5KNXjzaJ87ZoZbmgFtOopxYk//sTmcp/QJA=; b=qbn+8DpOwyLGohac9z+t9iZ6CKV3IB10+jsTxx2Md6wBqajlSv2S12yEWBXlYfYN6M kr47sXJqeYMPADRkNV4Lnvi+lKOIGkbFLSWBwgTxPQNlzuN36/dPujanGPAERDaZzzMn BlIyOZz9SvokUwNRkEhWgR/Ai2WScbQ4qU/NK30vsCEoktDrFKZYOi2OQk/ggQ/WHUl0 FoL9hc1XHQsOP6nD+8b+8M7GYsX38P1eDgaLMI79cLZzEosm9lOId54R3z6Izahp07Sz uN91Oye1okLlmbmCms/ZAO7TSl0Y5tPfnaBzprLHNqTdY7acsV1mtlRqfwl0eoC1azwV j5Ng== X-Gm-Message-State: AOAM531eUs0Esd1QfYApYgUigkWOwPu0cW28miotakxmDfz5y25tiCBz PYJ/Cxm0FQd9ZYddAnRopHir4jnUSFeXnNXBOLSuRZlf X-Google-Smtp-Source: ABdhPJxuZl2/gk5EVPR2sZV5nxsX8sy6NrapfZB5bgMcEwPiyTPXF+qMeWT8JkSTdwX58nBCjSi3yF7iV7d1wOV1L/0= X-Received: by 2002:a2e:b550:: with SMTP id a16mr819281ljn.345.1592293826876; Tue, 16 Jun 2020 00:50:26 -0700 (PDT) MIME-Version: 1.0 References: <9D1E1E08-7DD5-4FD3-B08E-58254CC75FC5@newclarity.net> In-Reply-To: <9D1E1E08-7DD5-4FD3-B08E-58254CC75FC5@newclarity.net> Date: Tue, 16 Jun 2020 09:50:10 +0200 Message-ID: To: Mike Schinkel Cc: PHP internals Content-Type: multipart/alternative; boundary="000000000000edeb1605a82ecbe2" Subject: Re: [PHP-DEV] Remove LSP checks on static methods? From: nikita.ppv@gmail.com (Nikita Popov) --000000000000edeb1605a82ecbe2 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Tue, Jun 16, 2020 at 8:59 AM Mike Schinkel wrote: > Hi internals, > > Given that there appears to be some appetite to reduce checks for > inappropriate signatures[1] I am wondering if anyone has strong opinions = =E2=80=94 > pro or con =E2=80=94 on removing checks for static methods? > > My primary use-case where I would like to see checked relaxed is for > static methods used as factory methods[2]. > > Per [3] it seems that all but the least upvoted answer argues that LSP > applies to instances, not static methods. > > Per [4] it seems that all upvoted answers agree that constructors should > not be constrained by LSP, and since a factory method is a form of a > constructor it would seem that if constructors do not require LSP then > factory methods would not either. > > Does anyone see any issues with relaxing these checks for static methods > that would have them downvote an RFC on the topic? > Hi Mike, The problem here is that static methods signatures are subject to LSP if they are used in conjunction with late static binding (LSB): class A { public static function test() { static::method(); // May call A::method(), B::method() or any child. // Signature must match for this to be sensible! } } class B extends A { } I do agree that the current situation is sub-optimal, because certainly not all static methods actually are used with LSB. But we do not presently distinguish these cases. If that problem can be addressed in some way, then I agree that (non-LSB) static methods should be exempt from LSP, just like constructors are. Regards, Nikita --000000000000edeb1605a82ecbe2--