Re: [RFC] Change Directory class to behave like an opaque object

From: Date: Tue, 01 Oct 2024 16:36:12 +0000
Subject: Re: [RFC] Change Directory class to behave like an opaque object
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-125712@lists.php.net to get a copy of this message
On Wednesday, 25 September 2024 at 10:12, Nick Lockheart <lists@ageofdream.com> wrote: > On Sat, 2024-09-14 at 15:33 +0000, Gina P. Banyard wrote: > I don't suppose we could call the Directory class something else, like > "SPLDirectory"? > > You can't make a Directory with new (or at least you > aren't supposed > to be able to), so any existing code would already get a Directory > object with dir() not new > Directory(). There would be no BC break > with a rename. This is factually incorrect. This would be a large BC break, moreover PHP "owns" the global namespace. If you are in a namespace and attempting to instantiate a class named Directory you will either get the namespace version of the class, or an Error as there is no fallback to the global namespace for classes. Otherwise, if you are in the global namespace and try to create a class which is called Directory this would result in an Error being thrown. Finally, people may have typed properties, or parameters with the type Directory, renaming this would break all that code. Best regards, Gina P. Banyard

« previous php.internals (#125712) next »