On 4 May 2025 14:52:23 BST, "Tim Düsterhus" <t...@bastelstu.be> wrote:
>> It's also not a new problem: PHP doesn't enforce a file and directory
>> layout, and libraries can and do define things "inside" each other's
>> namespaces. When declaring a class, you have to be aware of whether a class
>> with the same fully-qualified name has been, or will be, declared in another
>> file.
>
>This is correct, but all these other classes that could conflict are part of
>the *public API* of a library. But now with private nested classes I would
>also be aware of the private part of a library to avoid conflicts.
The classes that you'll need to be aware of will exist whether this feature is
added or not, and you'll already need to avoid conflicting with them - usually
by simply avoiding the main namespace prefix of the library.
Probably they will be currently marked "@internal" or highlighted in
documentation in some way, to indicate that they are not intended as part of
the public API; the only difference will be that now you'll get an error if you
ignore that documentation.
Rowan Tommins
[IMSoP]