Use declaration outside of namespace
| From: | Robert Stoll | Date: | Wed, 29 Oct 2014 09:12:12 +0000 |
| Subject: | Use declaration outside of namespace | ||
| Groups: | php.standards | ||
| Request: | Send a blank email to standards-+get-528@lists.php.net to get a copy of this message | ||
Heya,
I always found it very ugly that it is possible to define a use outside of a namespace. Consider the
following:
use foo\Bar;
namespace test;
new Bar(); //error, test\Barnot found
I do not see why we should actually support this behaviour in the specification of PHP. I do not see
it as a bug in the
current PHP implementation but I think we should consider to remove it in PHP 7. Although, it is not
a bug, the use
declaration is simply ignored as far as I can tell, but I suppose it confuses the user.
Nevertheless, even if we declare
it as a "feature" I think it should not be a "feature" of the specification.
Thoughts?
Cheers,
Robert