Hi

Am 2026-06-04 01:13, schrieb Daniel Scherzer:
Seeing no further feedback, I have adjusted the RFC and the implementation
to only allow access to protected properties/methods/constants.
This qualifies as a "major change" and triggers a 14 day cooldown period.

I've given the RFC another read and stumbled over:

Friendship is not inherited. If UserFactory has a subclass NamedUserFactory, that subclass cannot access the protected details of User

From what I see this would also be in violation of the LSP, because subclasses are not fully interchangeable with the top-level class. It would also need clarification what the relevant “authority” for accessibility is: Is it the class name of the actual class or is it the defining class of the method in question?

i.e.

class User { friend UserFactory; protected function __construct() { } }

    class UserFactory {
        public function foo() { new User(); }
    }

    class ChildUserFactory extends UserFactory { }

    $f = new ChildUserFactory();
$f->foo(); // Is this legal? ChildUserFactory is not a friend, but foo() is defined in UserFactory.

Best regards
Tim Düsterhus

Reply via email to