Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:110565 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 53033 invoked from network); 16 Jun 2020 09:23:54 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 16 Jun 2020 09:23:54 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 67AAB1804B7 for ; Tue, 16 Jun 2020 01:09:16 -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_H3,RCVD_IN_MSPIKE_WL,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-ot1-f46.google.com (mail-ot1-f46.google.com [209.85.210.46]) (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 01:09:12 -0700 (PDT) Received: by mail-ot1-f46.google.com with SMTP id n6so15306938otl.0 for ; Tue, 16 Jun 2020 01:09:12 -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=NLsVQOVWGyBIzeXM2FRKkcpkLjFRfZuXXl+xlxwtwN4=; b=MSm70sX3x/JADd0+Z/mAnKXebU6mFy1L6H8sygI94FBCdggFBtlCMafR/FjqJ/3w8C ZMWn4zqtdlsyLa/Bn7SVzFGMdaW8lma0NmiVlbqTs8Z+/6jcjXwDfbT73IzqsTFTAgSD x1Us8MvIGhOrYdNANVRbYYWUqIpw5f6M/QgSsxIdxJnXr6gMbv3W3J+osRl5pDuqnRia V87A1x67eLHd5eIYRZX9o3soxoC+GAwqlTErwpzx2VcFMDn7Mqx9AzRr1tbe5nC3Y6dd 11bCm+lgAr4+UXrKiHxQ7avXQH0MgQkCXAGhWhH3lDvBVCCujLh3+W6P1mVXrceNiKEA OKig== 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=NLsVQOVWGyBIzeXM2FRKkcpkLjFRfZuXXl+xlxwtwN4=; b=ReXKZQvnPhpURwey/NRJE8IMWJNTR4nj+rWJbPuVwKoOOLal/VWT1Z7QQIrBdyNsJj 5IkPhbKnzH+m9IqZhUtWnOrzMBouopHRaRlfsz2wg6WCOMQvrIagbQOqifdmkRH3vPpJ Fhf/WHry5Al75i3TL1jofCzmlihWoFCG8B/H7wjtbWzg4Q1QyW9KksaWoipd1dHgVdsV IB2rEFeuYbv6y/hvgq11ED9hzLNH594BE6ey79iTpwBWKjjFQEM28qPj9t3Qb7OeuLA1 NeJb72ii2c+tw3/xqgCV1YYwg7zV3gPyhJ7nkX6gDWlH2STAEbxf+nAR/uzdNVXs+jBU GIzQ== X-Gm-Message-State: AOAM530XLxGgDDxk+w3lDRHGyeJgbAnTWBAkjxFl9VnUfHfzWiXFRwS3 jtlLAen+dcQAYsSRScYSly1EP0FJc6hIU3XjbzI= X-Google-Smtp-Source: ABdhPJyWQkfLUFKgFQwy1u0okcj6aUrJJ+HgC6wLbVBRdDHfJ1biXIWr0rs5MPFTy+EEkkdF8EC/rhEzMuEQ8hkcdNc= X-Received: by 2002:a9d:3df7:: with SMTP id l110mr1432776otc.214.1592294952059; Tue, 16 Jun 2020 01:09:12 -0700 (PDT) MIME-Version: 1.0 References: <9D1E1E08-7DD5-4FD3-B08E-58254CC75FC5@newclarity.net> In-Reply-To: Date: Tue, 16 Jun 2020 10:09:00 +0200 Message-ID: To: Nikita Popov Cc: Mike Schinkel , PHP internals Content-Type: multipart/alternative; boundary="000000000000fec77405a82f0ead" Subject: Re: [PHP-DEV] Remove LSP checks on static methods? From: michal.brzuchalski@gmail.com (=?UTF-8?Q?Micha=C5=82_Brzuchalski?=) --000000000000fec77405a82f0ead Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable wt., 16 cze 2020 o 09:50 Nikita Popov napisa=C5=82(a= ): > 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 opinion= s > =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 shoul= d > > 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 method= s > > 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 n= ot > 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. > In that case maybe a core annotation like "Override" to relax checks ?? That way it'd say explicitly that it was intentional override. Cheers, Micha=C5=82 Marcin Brzuchalski --000000000000fec77405a82f0ead--