Re: [RFC] Asymmetric Visibility, v2

From: Date: Wed, 29 May 2024 19:51:03 +0000
Subject: Re: [RFC] Asymmetric Visibility, v2
References: 1  Groups: php.internals 
Request: Send a blank email to [email protected] to get a copy of this message
Hi

On 5/29/24 21:15, Larry Garfield wrote:
* We've brought back the abbreviated form, as public-read, something else set is the most common use case.
The most common use case is that 'get' and 'set' are symmetric. Any divergence from that should stand out and I think that the hamming distance between
    protected string $foo;
and
    protected(set) string $foo;
is too small. Other than that the proposal looks good to me. Ship it. ------ One note regarding the text. You already confirmed to me in private that:
    class Foo {
        private $dontTouchMe;
    }
    $backdoor = function ($key, $value) { $this->{$key} = $value; };
    $f = new Foo();
    $backdoor->call($f, 'dontTouchMe', 'butIDid');
    var_dump($f);
would work as expected with aviz. It would make sense to explicitly spell that out, just like it's explicitly spelled out that ReflectionProperty::setValue() works. Best regards Tim Düsterhus

Thread (57 messages)

« previous php.internals (#123457) next »