rfc:namespaces-for-internal-classes
This is an old revision of the document!
Request for Comments: How to write RFCs
- Version: 1.0
- Date: 2008-03-06
- Author: Lars Strojny lstrojny@php.net
- Status: Work in progress
- First Published at: none
Introduction
This RFC discusses the transition to real namespaces for internal classes in e.g. ext/spl.
Why should we use namespaces for internal classes?
Currently internal classes are inconsistently named. Just take a look at SPL:
- RecursiveIterator
- RecursiveIteratorIterator
- RecursiveRegexIterator
- RegexIterator
- RuntimeException
- SeekableIterator
- SimpleXMLIterator
- SplFileInfo
- SplFileObject
- SplObjectStorage
- SplObserver
Some of the classes in ext/spl are prefixed with “Spl”, some are not. To avoid naming collisions and as a structural element, namespaces were introduced in PHP 5.3. This gives us a chance to move all the Spl-classes in appropriate namespaces. Take a look at the following transitions:
- RecursiveIterator: Spl::Iterator::Recursive
- RecursiveIteratorIterator: Spl::Iterator::Recursive::Iterator
- RecursiveRegexIterator: Spl::Iterator::Recursive::RegexIterator
- RegexIterator: Spl::Iterator::Regex
- RuntimeException: Spl::Exception::Runtime
- SimpleXMLIterator: Spl::Iterator::SimpleXML
- SplObserver: Spl::Observer::Observer
- SplSubject: Spl::Observer::Subject
- SplFileInfo: Spl::File::Info
- SplFileObject: Spl::File::Object
- SeekableIterator: Spl::Iterator::Seekable
List of renamed classes
| Current name | New name |
|---|---|
| AppendIterator | ? |
| ArrayIterator | ? |
| ArrayObject | ? |
| SplDoublyLinkedList | ? |
| SplQueue | ? |
| SplStack | ? |
| SplHeap | ? |
| SplMinHeap | ? |
| SplMaxHeap | ? |
| SplPriorityQueue | ? |
| SplFastArray | ? |
| BadFunctionCallException | ? |
| BadMethodCallException | ? |
| CachingIterator | ? |
| Countable | ? |
| DirectoryIterator | ? |
| DomainException | ? |
| EmptyIterator | ? |
| FilesystemIterator | ? |
| FilterIterator | ? |
| GlobIterator | ? |
| InfiniteIterator | ? |
| InvalidArgumentException | ? |
| IteratorIterator | ? |
| LengthException | ? |
| LimitIterator | ? |
| LogicException | ? |
| NoRewindIterator | ? |
| OuterIterator | ? |
| OutOfBoundsException | ? |
| OutOfRangeException | ? |
| OverflowException | ? |
| ParentIterator | ? |
| RangeException | ? |
| RecursiveArrayIterator | ? |
| RecursiveCachingIterator | ? |
| RecursiveDirectoryIterator | ? |
| RecursiveFilterIterator | ? |
| RecursiveIterator | ? |
| RecursiveIteratorIterator | ? |
| RecursiveRegexIterator | ? |
| RegexIterator | ? |
| RuntimeException | ? |
| SeekableIterator | ? |
| SimpleXMLIterator | ? |
| SplFileInfo | ? |
| SplFileObject | ? |
| SplObjectStorage | ? |
| SplObserver | ? |
| SplSubject | ? |
| SplTempFileObject | ? |
| UnderflowException | ? |
| UnexpectedValueException | ? |
rfc/namespaces-for-internal-classes.1213728194.txt.gz · Last modified: (external edit)