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

From: Date: Thu, 27 Nov 2025 09:27:15 +0000
Subject: Re: RFC: Namespace-Scoped Visibility for Methods and Properties
References: 1 2 3 4 5 6 7 8 9 10 11 12 13  Groups: php.internals 
Request: Send a blank email to internals+get-129465@lists.php.net to get a copy of this message
Hi Am 2025-11-23 20:25, schrieb Rob Landers:
All in all, I feel that file-private symbols would solve many of the same problems, but be much easier to reason about. The SessionManager from your example could just be file-private.
You can use private(namespace) as effectively file-private, just use a namespace in a single file. And, if you need to refactor, you don’t need to be constrained to a single file.
The value of file-private for me is avoiding *naming collisions* for “helper functionality”, not restricting the API. For this purpose single-file namespace with namespace-private symbols would provide no value over just using a “hard to guess” class or function name, since in either case “external” code could also define symbols in that namespace. Best regards Tim Düsterhus

« previous php.internals (#129465) next »