Re: Namespace resolution rules has been changed?
| From: | Marcin Kurzyna | Date: | Fri, 14 Nov 2008 21:09:32 +0000 |
| Subject: | Re: Namespace resolution rules has been changed? | ||
| References: | 1 2 3 4 5 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-41917@lists.php.net to get a copy of this message | ||
Greg Beaver wrote:
>
> <?php
> namespace foo\classes;
> use sneaky\devil as foo;
>
> class buh extends foo\stuff {}
> \\ this extends sneaky\devil\stuff. oops... should have used \foo\stuff
> ?>
accualy I have a question about this if i may: why doesn't the use statement
fall under the same resolution rules as general code? that is why foo isn't
foo\classses\sneaky\devil?
personally i'd find this much more consistent if *anything* below namespace
declaration was relative to it. and i could always use absolute declaration
explicitly if i'd require it:
<?php
namespace foo;
use bar as A; /// ->resolves as A == \foo\bar
use \bar as B; /// ->resolves as B == \bar
?>
TIA
m.