> Sorry, I apparently missed this the first time. Would this mean that this 
> sort of script (where we're using use statements
> without a
> namespace) would no longer work?
> 
> <?php
> use GuzzleHttp\Client;
> 
> include __DIR__.'/vendor/autoload.php';
> 
> $client = new Client;
> // $client is a GuzzleHttp\Client object ?>
> 
> Because that strikes me as an irritating and unnecessary BC break for people 
> who are writing throwaway scripts (with no
> need to live in
> namespaces) that pull in namespaced libraries to me.
> 
> Adam
> 

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.
I am talking about the two following scenarios:

use \Exception;
namespace test;

$e = new Exception(); //would fails because test\Exception is unknown -> use 
was defined outside the namespace


Or
namespace a{
}

use some\UseDeclaration\which\is\outside\of\AnyNamespace as Useless;  // sorry 
for begin biased ^^

namespace test{
}


Cheers,
Robert


--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to