On Mon, May 10, 2021 at 10:50 AM Matīss Treinis <mrtrei...@gmail.com> 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, the
> curly braces occupy two lines for methods with multiline arguments. So for
> 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/

Reply via email to