On Saturday, 14 November 2026 at 00:32, Daniel Scherzer <[email protected]> wrote:
> Hi internals, > > On Sun, May 10, 2026 at 9:28 AM Daniel Scherzer <[email protected]> > wrote: > >> Hi internals, >> >> I'd like to start the discussion for a new RFC about adding friendship in >> PHP. This is a follow-up to a pre-RFC discussion thread >> https://externals.io/message/130710. >> >> * RFC: https://wiki.php.net/rfc/friends >> * Implementation: https://github.com/php/php-src/pull/21937 >> >> Thanks, >> -Daniel > > I'd like to resume discussion of this RFC since I was reminded of it at > MergePHP yesterday. > > As far as I can recall and find, there was no remaining feedback that I > needed to address. The current proposal is that friendship allows access to > protected but not private parts of a class. > > Since it's been a few months, this RFC discussion is considered inactive, and > per our policy a new cooldown period is required. This will not go to vote > before November 27. > > Please let me know if you have any feedback, > -Daniel I had a quick glance at the implementation and can't see any issues. However, I'm not convinced by the feature and will be voting against it. Moreover, I'm not sure I agree with the following premise in the RFC: > The use of reflection for bypassing visibility restrictions in non-test code > is generally frowned upon, and should not be recommended. While most usages of the reflection API are indeed in test code I don't understand why production code should allegedly not use it. Especially as in this case it seems to me that making the properties private and using reflection to by-pass the visibility by related components is very much a valid use case. Best regards, Gina P. Banyard
