Re: simple solution to another namespace conundrum?
| From: | Gregory Beaver | Date: | Fri, 20 Jun 2008 16:42:35 +0000 |
| Subject: | Re: simple solution to another namespace conundrum? | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-38481@lists.php.net to get a copy of this message | ||
Dmitry Stogov wrote:
> Looks fine, but probably we should emit error only if class declared in
> the same source file.
>
> Thanks. Dmitry.
>
Great, didn't realize how easy this would be. Attached patch does this,
but requires another test:
067.php.inc:
<?php
class B
{
function __construct(){echo __CLASS__;}
}
?>
--TEST--
067: Name ambiguity (import name & userspace class name in another file)
--FILE--
<?php
include __DIR__ . '/066.php.inc';
include __DIR__ . '/067.php.inc';
use A::B;
new B();
--EXPECT--
A::B
I can't express how excited I am about this patch - it fixes the biggest
single problem with the "use" statement and negates the need for any
weird stuff like "namespace __user__;" as proposed. Now, once we fix
resolution rules, namespaces will be stellar.
Greg