Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:114331 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 61326 invoked from network); 10 May 2021 09:05:14 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 10 May 2021 09:05:14 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 69D571804DA for ; Mon, 10 May 2021 02:12:43 -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-Virus: No X-Envelope-From: Received: from mail-pj1-f44.google.com (mail-pj1-f44.google.com [209.85.216.44]) (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, 10 May 2021 02:12:42 -0700 (PDT) Received: by mail-pj1-f44.google.com with SMTP id g24so9391637pji.4 for ; Mon, 10 May 2021 02:12:42 -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=ZnZ0290mCZ4/v4FhSdVy+U1kVZIVUHCAHi6TgKaJ954=; b=DTNjlGOm8Wj5MSj/cItn31rTOwJV7iW0DPKZhT4jV1lIqg1kPmrNaEIOn7hsbLfGN4 BFJsF5j74mR5tv1i61B0VJDAwPp0IQ83Rkx+A9pSlm1GrrZt35z4wa8+10FIUirk9RRg ZVP75YRm+HhPecYK9oDQmyTaXioF7UPj9fPUVdm5V3sxszxc/ZfJu6/hNSqP9/LWnuC4 DkbYPnX1UAyIAy1VbILoaH9rIJWtZOBOukxezEVxzsJYRH20oRjXC7+5AsN65oAZBchm HpUb3gPZ3wX9LrpTV1nKB1X6HiaTCnYqnziz5qtaJsep0i8UddOUuwYN8X8kHrfOox8q 4M/w== 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=ZnZ0290mCZ4/v4FhSdVy+U1kVZIVUHCAHi6TgKaJ954=; b=qiUenLpNewdGkLU9jubvDdKkRx2BQlwCOCqGIvrYv6y8wlX1E3StMdDtB7iAm0KCMt u/uZRxGnCzlNsXCMLCMfkkUZn14+4UwXhBuroJ2OSHGj+j23fp6EfpYNDoKkh/BwnJMj EVBG5l76YVc3i/JKWkpYbTqC4esx9at4R3RSAhlW2y7HivgZSP9gBkG+LgwR3ODlhHFr E/C9q/vHtuWOeZ53+8Jix5hQ6MwzMr/+VOezdSo1sTx6ZppYEw47K3nu8iJbB7xXvnVS SMMR9vECVkk/Mf0t+D+fxx85G7AbdkuQW7bt15b96ENl6dv+ZV0vZ8c7Bf1iPTt/RM3+ v7qQ== X-Gm-Message-State: AOAM532IlWA12pLm82l4kcGgg3iSBNVxMA6F37EmMp1RCGkeBi/OlbeJ 4VyArXdf8DMUXRiLR+x0+fWcamMl274MAZpa7WE= X-Google-Smtp-Source: ABdhPJyHK9yHPJxm9tEA+b+3bbLLAiDFoDnIkWMbS/pRsMeNIxTjGGiSdTdmTqhDTKiJiGwdiWQ5UjnG9nsZUcQcAl4= X-Received: by 2002:a17:902:8a8a:b029:ec:857a:4d51 with SMTP id p10-20020a1709028a8ab02900ec857a4d51mr22871899plo.68.1620637961173; Mon, 10 May 2021 02:12:41 -0700 (PDT) MIME-Version: 1.0 References: <1620635361.9147.0@gmail.com> In-Reply-To: Date: Mon, 10 May 2021 11:12:05 +0200 Message-ID: To: Marco Pivetta Cc: PHP Internals List Content-Type: multipart/alternative; boundary="000000000000fc401b05c1f62dcf" Subject: Re: [PHP-DEV] [RFC][Draft] Body-less __construct From: mrtreinis@gmail.com (=?UTF-8?Q?Mat=C4=ABss_Treinis?=) --000000000000fc401b05c1f62dcf Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable I don't necessarily agree with this point in particular - I mentioned PSR just-by-driveby, since whoever does follow that convention will face this issue - but the scope of the proposal is not limited to PSR adopters. It's also worth pointing out that PSR is not an "official" coding guideline for PHP, and therefore we should probably not limit the scope to it, simply because regardless if the brackets are on the same line or not, they are still there. IMO, this is a language issue - topical, cosmetic, and minor - but language issue nevertheless, in fact, exactly like the one had for attribute syntax. Let's gather some feedback and see. - Mat=C4=ABss On Mon, May 10, 2021 at 10:55 AM Marco Pivetta wrote: > > On Mon, May 10, 2021 at 10:50 AM Mat=C4=ABss Treinis > wrote: > >> Hi Marco, >> >> I am not sure, that's why I am asking for feedback. >> >> I have been converting a ton of code to use constructor property >> promotion and the absolute majority ends up with the method body being >> empty. I reckon this could be a nice eye-candy to have, however, it's >> nothing more than that. >> >> Another point to be made here, as far as my interpretation of PSR-12, th= e >> curly braces occupy two lines for methods with multiline arguments. So f= or >> whoever follows PSR-12, it's more like this, with brackets just dangling >> there across 2 lines. >> >> [...] >> class Foo { >> public function __construct( >> private Bar $bar, >> private Baz $baz >> ) { >> } >> } >> > > Given that: > > * `{}` can already represent what you want > * the issue is more of a coding-style related topic > > I suggest bringing this up in a new PSR instead. Consider that PSR-1, > PSR-2 and PSR-12 were designed pre-PHP-8, so they will need adjustments > again, but AFAIK nothing has moved yet, since the ecosystem is still > adapting to the PHP 8 changes (I myself haven't finished adopting it on > many of my libraries). > > If this is relevant to you right now, add an exclusion to your > `phpcs.xml.dist` instead: easier and less painful than expanding the > language for such a tiny detail. > > Marco Pivetta > > http://twitter.com/Ocramius > > http://ocramius.github.com/ > > --000000000000fc401b05c1f62dcf--