Re: [RFC] Asymmetric Visibility, v2

From: Date: Tue, 11 Jun 2024 13:36:34 +0000
Subject: Re: [RFC] Asymmetric Visibility, v2
References: 1 2 3 4  Groups: php.internals 
Request: Send a blank email to [email protected] to get a copy of this message
On Tue, Jun 11, 2024, at 6:47 AM, Rob Landers wrote:

> I’m also not a fan of the prefix style, but for different reasons. My 
> main reason is that it increases the minimum line-length, potentially 
> forcing you to chop things down into awkward looking lines:
>
> public
> private(set)
> string $longvarname {
>  get;
>  set;
> }
>
> I find that extremely hard to scan, but maybe others do not. The more 
> natural looking syntax is easier to scan and reason about (IMHO):
>
> public
> string $longvarname {
>  get;
>  private set;
> }
>
> If I’m having to read the code, I prefer to have everything near where 
> it is used so I don’t have to scroll up to the top and see its 
> visibility. Granted, I haven’t used property hooks and I have no idea 
> how IDEs will help here; maybe it is a non-issue — but I guess people 
> still have to do code reviews which very rarely comes with IDE powers.
>
> — Rob

I have never in my life seen someone split the visibility to a separate line from the type and
variable name in PHP.  I don't know why anyone would start now, especially not because of hooks
or aviz.  I just checked and PER-CS very directly states "All keywords MUST be on a single
line, and MUST be separated by a single space."  So splitting it like shown above would be
against standard coding conventions anyway.

This is really a strawman argument.

--Larry Garfield


Thread (57 messages)

« previous php.internals (#123578) next »