[php-langspec][Issue #238] - Specify when imported names become available
| From: | noreply@php.net | Date: | Sun, 05 May 2019 01:22:47 +0000 |
| Subject: | [php-langspec][Issue #238] - Specify when imported names become available | ||
| Groups: | php.standards | ||
| Request: | Send a blank email to standards-+get-1439@lists.php.net to get a copy of this message | ||
You can view the Issue on github:
https://github.com/php/php-langspec/issues/238
Opened By: mattacosta
Issue Description:
The specification currently states that use declarations bring a name into a scope, but that's
not exactly true, as imports are not available prior to the use declaration.
```php
namespace A {
class C {}
}
namespace B {
// Same scope, 'A\C' should be available right?!
$c = new C();
use A\C;
}
```
Without this restriction, an engine could theoretically make an initial pass to import names from
all use declarations, and therefore prevent a name resolution error from occurring.
**18-namespaces.md**
> A namespace-use-declaration imports — that is, makes available — one or more names into a
> scope, optionally giving them each an alias.