Re: AW: [PHP-DEV] forbid use declaration outside of a namespace in PHP 7

From: Date: Thu, 13 Nov 2014 11:29:07 +0000
Subject: Re: AW: [PHP-DEV] forbid use declaration outside of a namespace in PHP 7
References: 1 2 3 4  Groups: php.internals 
Request: Send a blank email to internals+get-78891@lists.php.net to get a copy of this message
On Wed, 2014-11-12 at 22:27 +0100, Robert Stoll wrote: > 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{ > } If I get it rigth this might break code by people who, for whatever reason, combine multiple PHP files into a single one. (cat *.php > full.php && php full.php) johannes

« previous php.internals (#78891) next »