Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:114328 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 55703 invoked from network); 10 May 2021 08:48:28 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 10 May 2021 08:48:28 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 6441A1804B1 for ; Mon, 10 May 2021 01:55:57 -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_H2,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from mail-io1-f53.google.com (mail-io1-f53.google.com [209.85.166.53]) (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 01:55:57 -0700 (PDT) Received: by mail-io1-f53.google.com with SMTP id z24so14065239ioj.7 for ; Mon, 10 May 2021 01:55:57 -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=y3euwdpM5ihAWLB5O4F3ZNF1xndDxBHWKEnxQCAP6oM=; b=ncGgKd6o5TZrxm739Ukxppi5dP7a115CiEEGyAZL1Nlu4dmAxhFmX/qfog75LeVZPy Qzu1lQLCscWFBcLYpKD8vuQfFWB8Lq8NHR9WFzYfS/5qWpr9gVuPLe1/Z2rzWjLGNrxA m1G3IjXpBb5L+HNFRR8J8rBvCX8GgQvn9x1eDVBIMlYn5Ahe/72/vDwdlER9UfKDdwbs MevUDNII/Srxcmewy5SpbBPIsU9hgB0CURkh7BXgjBVrXZJRxpY9UtNajbAl/BmhMZiQ /1bTT+3DUiXlOcaSpzmY1LniWQ4mqSNsc8L4UvFgk9gFtVFBxxC6Ii8kddWINejxO3Kl 350g== 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=y3euwdpM5ihAWLB5O4F3ZNF1xndDxBHWKEnxQCAP6oM=; b=j8sDW2rSdKAHgEXI+UgMw9pILDK1HHfLfWGJOsq8Jmr2ryiWp9wKLdxaE9pqKjJID7 h7peIqQjYKp1B+P+k/zmVd0FxiOWNSbhzSnUPeB4yAihgl0JeYHUOMzHf5fcywQDOKJM imspGbcpcyV9hQ16BMooSs0jPWLZv4RH0RXv+/bYEwXu1kDB91lVbsZuZE7j23Ex12dx CAtCMk5I7dHnjWxB1kxggg/oK8blfk6yblU+YP/RXg4LguFmT/Ad3ULqgWLCszG2efC5 wpx/nb98v4xeRYQAuExloWita+uMqAv5e613+pU0pEEUekuqaoxMnI9yTF0nZAryIeSP oe/g== X-Gm-Message-State: AOAM532vw6TJEw1EnibhLMI+9lJGhfT6GVQY472Y/WSTUQAWEt4FyMD1 fjhT9HkLNktexa2pfZrkEsqxNZ4bTeK5IabdCPE= X-Google-Smtp-Source: ABdhPJyRc/0W5+ty3BB+6Byr3I43NCbK/nF0qwllHZYp0dQGWf2nNROUVJyBj5QfzgNosD9VK9IWEx/IWWSPoXkoixk= X-Received: by 2002:a05:6638:10ec:: with SMTP id g12mr20434415jae.13.1620636954119; Mon, 10 May 2021 01:55:54 -0700 (PDT) MIME-Version: 1.0 References: <1620635361.9147.0@gmail.com> In-Reply-To: Date: Mon, 10 May 2021 10:55:42 +0200 Message-ID: To: =?UTF-8?Q?Mat=C4=ABss_Treinis?= Cc: PHP Internals List Content-Type: multipart/alternative; boundary="000000000000f5d3e805c1f5f145" Subject: Re: [PHP-DEV] [RFC][Draft] Body-less __construct From: ocramius@gmail.com (Marco Pivetta) --000000000000f5d3e805c1f5f145 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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 promotio= n > 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, the > curly braces occupy two lines for methods with multiline arguments. So fo= r > 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/ --000000000000f5d3e805c1f5f145--