Re: [RFC] isReadable/isWriteable property reflection
| From: | Larry Garfield | Date: | Thu, 04 Dec 2025 16:36:43 +0000 |
| Subject: | Re: [RFC] isReadable/isWriteable property reflection | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-129549@lists.php.net to get a copy of this message | ||
On Thu, Dec 4, 2025, at 8:05 AM, Nicolas Grekas wrote:
> Le jeu. 6 nov. 2025 à 00:28, Larry Garfield <larry@garfieldtech.com> a écrit :
>> In other news, Ilija and I said a year ago that we'd take a swing at adding
>> isReadable/isWriteable methods to ReflectionProperty. Took a while, but here we are. A strangely
>> small RFC from us:
>>
>> https://wiki.php.net/rfc/isreadable-iswriteable
>>
>
>
> Thanks for this.
> I also think the auto-scope is [NOT] a good idea. You state that 90% of use
> cases will need this but my experience doesn't back this claim. The
> only cases where I had to check for read/writeable were out of the
> local scope, so I'd say 100% of my experience goes against that 90%
> number ;) Joke aside, it'd be just fine to let ppl be explicit. That's
> better than "oops I forgot to give the correct scope" bugs.
>
> About magic methods, one unsets a property only to have __get/__set
> called. Existing code works with this assumption. This means we have to
> return true IMHO. Magic methods are just generic hooks also. Which
> means they should behave the same.
>
> Nicolas
Well, the only people who seem to have an opinion don't like "static", so we've
removed it. RFC updated.
As for __get/__set, that's so far one vote for ignore (Tim), and one for always-true (Nicolas).
Not a consensus. :-)
Nicolas, can you clarify with an example if/how ignore would break things?
I think once we settle that question and the cooldown passes we're ready for a vote, though at
this point that means January.
--Larry Garfield