However, in the global scope (no namespace) it would fail. This is a
bug that is easily fixed. use should allow re-aliasing of global
classes, and I could provide a very easy fix.
This is not a bug - since there you work with test::xmlreader, which of course you can define. But in global space you'd work with existing name xmlreader, which would be redefined. And PHP never allowed redefining classes.
file1.php:
<?php
class DB {}
?>
file2.php:
<?php
import DB as Other_DB;
include 'file1.php';
class DB extends Other_DB {}
?>
You mean 'use' should kill the old name? I don't think it's a good idea - we'd have to keep track of killed names, and since class can be named in a lot of ways - i.e. if you have name A::B::C::D you can alias any part of name, it would become messy.
Why exactly you need to rename existing classes?
--
Stanislav Malyshev, Zend Software Architect
stas@zend.com http://www.zend.com/
(408)253-8829 MSN: stas@zend.com