Re: RFC: Namespace-Scoped Visibility for Methods and Properties
| From: | Rowan Tommins [IMSoP] | Date: | Tue, 11 Nov 2025 15:14:33 +0000 |
| Subject: | Re: RFC: Namespace-Scoped Visibility for Methods and Properties | ||
| References: | 1 2 3 4 5 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-129199@lists.php.net to get a copy of this message | ||
On 11/11/2025 11:36, Derick Rethans wrote:
On Sat, 8 Nov 2025, Rowan Tommins [IMSoP] wrote:The main reason my mind went in that direction is that people are building attributes for this in userspace already - set the actual visibility to public, and then use an attribute for static analysis to restrict it. They also have a standard syntax for arguments, so it's easy to illustrate those without spending time imagining a new syntax. But in general, I agree, a native implementation would ideally look and feel like it matched the existing "private" keyword. -- Rowan Tommins [IMSoP]To spell those out, the prefix version could look like this: namespace Acme\AuthLib\Somewhere\Deep\In\Package; // ... #[NamespacePrivate('Acme\AuthLib', includeChildren: true)]Whatever the way to define a prefix is going to be, I disagree with that being done through attributes. Nowhere in the language do these annotations (yet) interfere with how code can be run.