Hi!
> No, we can not import namespace directly for now :
Of course you can. You just missing on what namespace import means in
PHP, it's not like Java (though a bit like Python).
> <?php
> namespace A {
> class B {}
> }
>
> namespace {
> use A;
>
> var_dump(new B());
> }
use A is a no-op, just as the warnings tell you. You can just write A\B.
It's only 2 characters more. If your A is longer, then you can alias it
to something shorter.
> and if we need alias we could:
> <?php
> // reduce
> use GlobalNamespace\SubSpace\ThirdSpace\Class1;
> use GlobalNamespace\SubSpace\ThirdSpace\Class2 as Alias2;
> use GlobalNamespace\SubSpace\ThirdSpace\ForthSpace\Class3 as Alias3;
You could just do
use GlobalNamespace\SubSpace\ThirdSpace as Spc;
$a = new Spc\Class1();
--
Stanislav Malyshev, Software Architect
SugarCRM: http://www.sugarcrm.com/
(408)454-6900 ext. 227
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php