Re: Module or Class Visibility, Season 2

From: Date: Fri, 30 May 2025 19:29:35 +0000
Subject: Re: Module or Class Visibility, Season 2
References: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17  Groups: php.internals 
Request: Send a blank email to [email protected] to get a copy of this message


On 30 May 2025 19:21:08 BST, Alwin Garside <[email protected]> wrote:
>In the example above, I image calling or extending the Foo::bar() method from
>somewhere outside the Acme namespace would trigger an E_USER_WARNING or E_USER_NOTICE.
>The warning/notice could then be suppressed when explicitly overriding an #[\Internal]
>method with #[\Override].


I don't see any reason for the message to be any quieter or easier to override than calling a
private method. 

Indeed, one use of an internal/module-private feature would be when the author wants to split up a
class that has a large number of private methods: the new classes need to be able to talk to each
other, so the existing "private" keyword is no longer appropriate, but the intended
surface to users of the library has not changed. The user is making exactly the same decision by
ignoring the "internal" flag as they are if they use reflection or code-rewriting to
ignore/remove the "private" flag.

Rowan Tommins
[IMSoP]


Thread (50 messages)

« previous php.internals (#127513) next »