Hi Ollie, > On Aug 8, 2022, at 6:12 AM, Ollie Read <php@ollie.codes> wrote: > > On Mon, Aug 8, 2022, at 3:54 AM, Mike Schinkel wrote: >> 3.) I have concerns about the proposed methods isProtectedSet() and >> isPrivateSet(). >> >> These names feels like we are asking if some thing "Set" is "Protected" or >> "Private" where no such "thing" exists in this context. >> >> In other words it reads as if you are asking "Is it a *protected* Set?" or >> "Is it a *private* Set?" Such naming also does not relate to the Property >> itself which is what the prefix verb "is" is acting on. >> >> I would propose instead we consider the following are these instead would be >> asking the *ability* to "Set" the Property is "Protected" or "Private" where >> The Property is again what the prefix verb "is" is acting on: >> >> isSetProtected() >> isSetPrivate() >> isGetProtected(), and >> isGetPrivate() > > I feel almost as if we shouldn't pollute ReflectionProperty with these > additional methods but should instead have something like > ReflectionAsymmetricProperty, which would in turn extend ReflectionProperty.
On my 3rd point that you quoted my primary concern was that I felt the RFC solution of "is<Visbility>Set()" was hard to reason about but my own suggestion almost incidental. I felt if I voiced my concerns then it would be incumbent upon me to at least suggest an alternative. OTOH, I'm not sure I would embrace yet another reflection class. I think that would make an already (IMO) too-complex reflection class hierarchy even more complex. Maybe a better solution could be to add an optional $flags parameter to the existing is<Visbility>() methods, something like? isPublic(ReflectionProperty::GETTABLE) isProtected(ReflectionProperty::GETTABLE) isPrivate(ReflectionProperty::GETTABLE) isPublic(ReflectionProperty::SETTABLE) isProtected(ReflectionProperty::SETTABLE) isPrivate(ReflectionProperty::SETTABLE) isPublic(ReflectionProperty::GETTABLE & ReflectionProperty::SETTABLE) isProtected(ReflectionProperty::GETTABLE & ReflectionProperty::SETTABLE) isPrivate(ReflectionProperty::GETTABLE & ReflectionProperty::SETTABLE) #fwiw -Mike > I guess it depends on how it's handled. If all property handling is updated > so that "public int $number" is identical to "public:get public:set int > $number", there's no issue, but if we treat those with separate visibilities > to be additional, it probably makes sense to be somewhat separate. > > While isGetProtected() is technically false for "public int $number", if it's > not inferred, it's semantically incorrect. A good example of this is > ReflectionMethod::getPrototype, which throws an exception if there's no > prototype. Although this is somewhat bizarre, it is at least a thing we do. > > --- > Best Regards, > *Ollie Read*