Re: [STANDARDS] Use declaration outside of namespace
[email protected] (Ben Ramsey)
| Newsgroups | php.standards |
|---|---|
| Message-ID | <[email protected]> |
> On Oct 29, 2014, at 9:04 AM, Chris Wright <[email protected]> wrote: > > It does, this example does indeed place something *outside* a namespace, > and I am quite surprised that PHP doesn't bork at this already. I would > hope no-one would ever write code like this anyway, but I'm sure I would be > disappointed. > I write scripts all the time that I run from the command line, and these use namespaces but do not specify a namespace of their own. So, these use statements are *outside* a namespace. Are you saying this is incorrect to do? For example: <?php require_once 'vendor/autoload.php'; use Foo\Bar; $bar = new Bar(); $bar->doSomethingWithBar(); ?>