Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:118413 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 55868 invoked from network); 11 Aug 2022 12:24:24 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 11 Aug 2022 12:24:24 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 80CDD1804BC for ; Thu, 11 Aug 2022 07:26:27 -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.0 required=5.0 tests=BAYES_20,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS15623 212.45.192.0/19 X-Spam-Virus: No X-Envelope-From: Received: from mail.gna.ch (mail.gna.ch [212.45.196.109]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Thu, 11 Aug 2022 07:26:26 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by darkcity.gna.ch (Postfix) with ESMTP id 2A6673A1DB4 for ; Thu, 11 Aug 2022 16:26:25 +0200 (CEST) X-Virus-Scanned: amavisd-new at example.com Received: from mail.gna.ch ([127.0.0.1]) by localhost (darkcity.gna.ch [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id lpz-XlK04HHB for ; Thu, 11 Aug 2022 16:25:57 +0200 (CEST) Received: from smtpclient.apple (unknown [IPv6:2001:918:ff83:102:b90a:2f05:5091:7c4d]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by darkcity.gna.ch (Postfix) with ESMTPSA id 4B5523A1D76 for ; Thu, 11 Aug 2022 16:25:57 +0200 (CEST) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3696.120.41.1.1\)) Date: Thu, 11 Aug 2022 16:25:57 +0200 References: <62f48769.250a0220.37387.53b5SMTPIN_ADDED_MISSING@mx.google.com> <01D4987C-FD37-4BD2-A1AC-DD10F808F248@gmail.com> To: PHP Developers Mailing List In-Reply-To: <01D4987C-FD37-4BD2-A1AC-DD10F808F248@gmail.com> Message-ID: <69767A9B-B336-49AC-8932-C895DB3B373D@cschneid.com> X-Mailer: Apple Mail (2.3696.120.41.1.1) Subject: Re: [PHP-DEV] [Concept] Extension methods From: cschneid@cschneid.com (Christian Schneider) Am 11.08.2022 um 11:03 schrieb Alex Wells : > That=E2=80=99s just a concept. I=E2=80=99d love to bring a lot more = examples in an RFC if there=E2=80=99s more positive than negative = feedback. Again, I=E2=80=99m more looking for feedback than trying to = convince someone, but I=E2=80=99ll showcase a couple real comparisons = for some context: >=20 > Compere these (copied from real world project/public composer = packages): > ```php > $className =3D Str::studly(implode('_', array_slice(explode('_', = $file->getName()), 4))); > // vs > $className =3D = $file->getName()->explode(=E2=80=98_=E2=80=99)->slice(4)->implode(=E2=80=98= _=E2=80=99)->studly(); This reminds me of the proposed (but declined) pipe operator https://wiki.php.net/rfc/pipe-operator-v2 but I'd still prefer to have it as a generic operator instead of using a = pseudo-OO approach for this. I say pseudo-OO because not everything in PHP is an object plus using = the -> syntax IMHO muddies the water. Regards, - Chris