Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:122803 X-Original-To: internals@lists.php.net Delivered-To: internals@lists.php.net Received: from php-smtp4.php.net (php-smtp4.php.net [45.112.84.5]) by qa.php.net (Postfix) with ESMTPS id 572AF1A009C for ; Fri, 29 Mar 2024 13:04:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1711717485; bh=GKD6IdPyvQ115AL4u9Yqx3bh0RXAFCCuhjRSXH9+4Yk=; h=In-Reply-To:References:Date:From:To:Subject:From; b=QI6CZ8DKWZESByak228brxBS3MmvSVF4I/tn/04lX9k6zUOLQ0+dUsDyeBS/60vfY rNMdB77T1X4ryenB6eeyuwTA4YWFSwCIGo7fhsVcMR75ojvwm/RDG/BeLJqNpb4QDt u2RxaPDqpK2h/6sm+pYUCG3mv2BM+Xwzblj3pSRZv/wV2Cm3hG8nRuT15JmB0FLG8s CvGCTqkzkbat+XVcOTPkwsT588JA7MlJxyY+h6otogPMe6uU8mXxDqO2LVZpXhOaJ0 rr38r20uwZ9YQyx9GvAq2hwouGkX93pO2Fl1JeMrmT5P3En6mW7T38FTUczxkihPzp ihp7ra5LJCohg== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id C741718004E for ; Fri, 29 Mar 2024 13:04:44 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on php-smtp4.php.net X-Spam-Level: * X-Spam-Status: No, score=1.4 required=5.0 tests=BAYES_50,BODY_8BITS, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_MISSING, RCVD_IN_DNSWL_LOW,SPF_HELO_PASS,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: No X-Envelope-From: Received: from wout3-smtp.messagingengine.com (wout3-smtp.messagingengine.com [64.147.123.19]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Fri, 29 Mar 2024 13:04:44 +0000 (UTC) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.west.internal (Postfix) with ESMTP id 5476C3200495 for ; Fri, 29 Mar 2024 09:04:17 -0400 (EDT) Received: from imap50 ([10.202.2.100]) by compute1.internal (MEProxy); Fri, 29 Mar 2024 09:04:17 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= garfieldtech.com; h=cc:content-transfer-encoding:content-type :content-type:date:date:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to; s=fm2; t=1711717456; x=1711803856; bh=wRcjIK1SQ2VdFZg2kU/Gk oV7bADlQTFTq/KLhQe8TI0=; b=Cuc0WzhjyciiDgtL/Q4Un9Unv9LZce04IIYpB 6iUf2oDXOukZpMP76p5sr5AobDGIQ6Jdd5Byao6+PidL6US86BIpKiX3YpOxD8kK FvCiM78bqU8MYhDQg2H3+Gw2ZSur73W12iJbQ/dyT5FanZIzUyNVj1AbCpe/G/OF u8kFJyFil3GV5/Suvbyikp8n6x2vfW7663YIXOVWcdCAvbr5JmS1yxTL6vWGR17q qjzeERc2mDsF/be9OvzhV1wGUuOkUK089TEzPCtjMb/oWlMEJ7u9pxwD1/0Fm7de R/YNXS5B+iDdOy9XX6ZdMHqoHxYUou//DPolI6/N3wvyeX2mA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t=1711717456; x= 1711803856; bh=wRcjIK1SQ2VdFZg2kU/GkoV7bADlQTFTq/KLhQe8TI0=; b=k YG28iNY2ZbMceYTpY+ATrROdcFlECB6FZws1UE/9eZwFkMIZ5awnLLq4FSwj384h sGFfEYywgN7KqH5mTiZzfq1uZMx756Ip20dt74s5uRrIvsLoYQDcXwe6U5GFdslD 9yivYOjiJbgcuh54H6a1+tGPkGMhUpM++uwFsaEuyt0TcFhIYYeOF01NjqCg2md1 wSzeX9vI8RcY7vwItIV5Z7p1/257CNvSWJJeFBGjbrOEIUMbPCQteztwklKllYNb XXW8cYcZ4qkn4ecJXIMAm2zySHnpqjHPZh4P+Dl3ykzK/kFZXJSFr/fxIkcIvrVB Mi8l1laBeWLmPi3QXLhnQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledruddvvddggeekucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepofgfggfkjghffffhvffutgfgsehtqhertderreejnecuhfhrohhmpedfnfgr rhhrhicuifgrrhhfihgvlhgufdcuoehlrghrrhihsehgrghrfhhivghlughtvggthhdrtg homheqnecuggftrfgrthhtvghrnhepffeivddufedufefgveffueetveeiiedufedvudel heeivefgveethffftddvhedunecuffhomhgrihhnpehphhhprdhnvghtpdhpvggrkhgurd gtohhmnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhep lhgrrhhrhiesghgrrhhfihgvlhguthgvtghhrdgtohhm X-ME-Proxy: Feedback-ID: i8414410d:Fastmail Received: by mailuser.nyi.internal (Postfix, from userid 501) id 6C1681700093; Fri, 29 Mar 2024 09:04:16 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.11.0-alpha0-333-gbfea15422e-fm-20240327.001-gbfea1542 Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net MIME-Version: 1.0 Message-ID: In-Reply-To: References: Date: Fri, 29 Mar 2024 13:03:55 +0000 To: "php internals" Subject: Re: [PHP-DEV] [RFC] Invoke __callStatic when non-static public methods are called statically Content-Type: text/plain;charset=utf-8 Content-Transfer-Encoding: quoted-printable From: larry@garfieldtech.com ("Larry Garfield") On Fri, Mar 29, 2024, at 2:39 AM, =ED=95=98=EB=8A=98=EC=95=84=EB=B6=80=EC= =A7=80 wrote: > Hello. > > I created a wiki for __callStatic related issues. > Please see: > https://wiki.php.net/rfc/complete_callstatc_magic > I look forward to your interest and advice. I am firmly against this proposal. I think my objection boils down to this line in the RFC: > Of course, calling non-static methods in a static-like manner can be c= onfusing, but in modern PHP, it has already become common practice.=20 I would argue this statement is false. Calling non-static methods in a = static-like manner is confusing, which is why in modern PHP one should n= ever do that, and respect that static and non-static methods exist in a = separate universe. Static methods are methods *on a type*. Non-static = methods are methods *on an instance*. Those are not the same thing.[1] It would be more accurate to say "calling non-static methods in a static= -like manner is common *in Laravel*," where the badly-named "facades" sy= stem serves as a poorly designed, hard to debug, hard to test, archaic a= lternative to using dependency injection. While there may have once bee= n an argument that DI was "too hard" for simple cases a decade ago or mo= re (though even then I think it was a bade trade-off), the combination o= f auto-wiring DI Containers (which Laravel pioneered in PHP) and constru= ctor promotion (introduced in PHP 8.0, 3.5 years ago.) completely elimin= ates those arguments. The level of effort to do actual DI today is triv= ially small, and the benefits over magic hidden globals are massive. Laravel Facades are a relic of an older time best avoided, even in Larav= el projects. (I am far from the only person to argue this; many even wi= thin Laravel's inner community make this argument.) Adding features to the language that seemingly exist only to make that p= articular buggy hack easier to do is a step backwards, and I would argue= harmful for the language. On the contrary, I would favor going the oth= er direction: Calling a static method as though it were non-static curre= ntly works, and I would support making that an error, to further emphasi= ze that static and non-static methods are not interchangeable. [1] https://peakd.com/hive-168588/@crell/cutting-through-the-static --Larry Garfield