Re: RFC: Namespace-Scoped Visibility for Methods and Properties

From: Date: Sun, 09 Nov 2025 20:28:15 +0000
Subject: Re: RFC: Namespace-Scoped Visibility for Methods and Properties
References: 1 2 3 4 5 6 7  Groups: php.internals 
Request: Send a blank email to internals+get-129181@lists.php.net to get a copy of this message
Hi

On 11/9/25 16:33, Larry Garfield wrote:
In particular, the syntax is a hard-no. It runs contrary to how the aviz syntax was defined, as others have already noted. If you don't want to use internal(set) to save internal for some other use, that's fine. Come up with a different keyword. :-) But <allowed scope>(<operation>) is the syntax model that aviz established, and tossing extra parens in there just confuses things for everyone.
I agree with that.
If it really does need to be an entirely separate dimension of scoping, then I would argue it's too complex to capture in just keywords and Rowan's attribute proposal becomes even more compelling.
I disagree that this should be an Attribute for the inverse of the reasons of why #[\Override] *is* an attribute: https://wiki.php.net/rfc/marking_overriden_methods#why_an_attribute_and_not_a_keyword Visibility is part of the public API and by making this an attribute, the code will seemingly appear to work in older PHP version that do not yet know about the attribute, but its behavior will differ. It would of course also be syntactically / visually inconsistent with any other visibility definition. Best regards Tim Düsterhus

Thread (32 messages)

« previous php.internals (#129181) next »