Robert Stoll wrote on 12/11/2014 21:27:
That's still perfectly fine because in your code the use statement is not
outside of a namespace, it is implicitly in the default namespace.
Surely if that's true of Adam's example, it's true of yours as well?
namespace a{
}
use some\UseDeclaration\which\is\outside\of\AnyNamespace as Useless; // sorry
for begin biased ^^
namespace test{
}
This scenario looks identical to Adam's to me, unless you propose to
look at the entirety of the file to detect if there is something other
than a use statement in the default namespace.
For that matter, what about this:
use GuzzleHttp\Client;
include __DIR__.'/vendor/autoload.php';
$client = new Client;
// $client is a GuzzleHttp\Client object
namespace Foo;
$client = new Client;
// $client is a Foo\Client object
Certainly this code is not *sensible*, but it does have a meaningful
behaviour, which derives directly from the previous examples and
documented uses of the namespace keyword. I'm not sure how you'd
distinguish between the various combinations here.
Regards,
--
Rowan Collins
[IMSoP]
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php