Benjamin Schulz wrote:
> Hi all,
> 
> import Foo::Bar AS DomDocument;
> import Foo::Exception;
> import MyStuff::Dom::XsltProcessor;
> 
> Result in a "Fatal error: Import name '...' conflicts with defined class"
> Of course i want to refer to my own exception in my application or
> framework as "Exception", and of course i want to use it without
> prefixes (import myStuff::Exception AS MyStuffException), i wouldn't use
> namespace otherwise (there is no other benefit, right?).
> It's not that one accidentally puts an "import Foo::Exception" in his
> file ..
> 
> Is there a good reason for this bevhaviour that i don't see? There is
> still ::Exception to access the class in the global namespace.
> 
> regards,
> Benjamin

Hi Benjamin,

If you are aliasing a class to the same name as an existing class, you
should also import that class with another name:

<?php
import ::Exception as Notused;
import Foo::Exception;
?>

This is somewhat unintuitive, but is pretty simple to solve.

Greg

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to