Hi,

I like the proposal however the choice of syntax seems inconsistent.

Traditionally visibility is defined by a single keyword like private,
protected, etc, each implicitly defining the scope from which the property
is accessible.

Aviz (PHP 8.4) added the possibility of defining the operations that can be
performed in the given scope like (get) or (set), the scope however is
still defined by the existing keywords (private for class scope and
protected for child scope).
As such, I'd suggest to use a dedicated keyword for namespace level
visibility like "internal" or "ns-private", the operations will still be
defined within braces ().


An excerpt from future scope of aviz rfc differentiating between visibility
and operations.

> At this time, there are only two possible operations to scope: read and
write. In concept, additional operations could be added with their own
visibility controls. Possible examples include:
protected(&get) - Vary whether a reference to a property can be obtained
independently of getting the value. (Would override the set visibility if
used.)
private(setref) - Allows a property to be set by reference only from
certain scopes.



[image: --]

Faizan Akram Dar
[image: https://]faizanakram.me
<http://faizanakram.me>


On Sat, 8 Nov 2025, 14:21 Rob Landers, <[email protected]> wrote:

> Hello Internals,
>
> I’d like to introduce an RFC for discussion:
> https://wiki.php.net/rfc/namespace_visibility which proposes a new
> visibility modifier: private(namespace).
>
> This idea has appeared several times in previous threads but never
> progressed to a formal proposal (from what I could find). My hope is that
> with defined semantics, examples, and implementation details, we can
> evaluate it properly and see whether there’s support for moving forward.
> Feedback is very welcome.
>
> Sincerely,
>
> Rob Landers
>

Reply via email to