On Tue, Jun 4, 2024, at 5:01 AM, Andreas Heigl wrote:
> There is only one thing that I stumbled upon which struck me as odd:
>
> > The set visibility, if specified explicitly, MUST be equal to or
> > lesser than the main (get) visibility. That is, protected public(set)
> > string $foo is not allowed.
>
> Why?
>
> Why can we not set a property as publicly writable but unreadable?
>
> If that is a technical necessity, then so be it. But if that is a
> logical limitation, then I'm asking myself: why do we want to explicitly
> limit possible usecases? Not that I have one right now in my mind but I
> do know that we used similar settings in Filesystems for letterbox
> systems where users could copy files into other users letterbox (write
> only) without being able to later see the files.
>
> Similar possibilities are available here here a property could be
> publicly writeable but only privately readable as read-access is only
> granted via a method.
>
> I'm not saying it's the usualy use-case, but why explicitly disallowing it?
It's not a technical requirement. Mainly, we just cannot think of a reason why you'd ever
do that, so making some seemingly nonsensical cases illegal seems like a good guardrail.
If enough people felt strongly that it should be allowed, I don't think there's any
technical reason it couldn't be allowed, other than it would allow some rather silly
combinations. (Ilija can tell me if I'm wrong.) However, also note that it is, of course,
much easier to allow more combinations in the future than to remove them, should we find they cause
trouble.
--Larry Garfield