php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #46755 warning: use statement with non-compound name
Submitted: 2008-12-05 04:24 UTC Modified: 2009-01-14 13:58 UTC
Votes:4
Avg. Score:5.0 ± 0.0
Reproduced:4 of 4 (100.0%)
Same Version:4 (100.0%)
Same OS:3 (75.0%)
From: david at grudl dot com Assigned: dmitry (profile)
Status: Closed Package: Scripting Engine problem
PHP Version: 5.3.0alpha3 OS: *
Private report: No CVE-ID: None
 [2008-12-05 04:24 UTC] david at grudl dot com
Description:
------------
Declaration 'use Foo' produces invalid warning "The use statement with non-compound name 'Foo' has no effect".


It has effect:

namespace Bar;
new Foo\Class; -> object Bar\Foo\Class;


namespace Bar;
use Foo;
new Foo\Class; -> object Foo\Class;


Reproduce code:
---------------
use Foo;


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-12-19 17:19 UTC] david at grudl dot com
It would be very nice if the error was fixed, because it is  difficult to test alpha3 with a tons of Warnings: The use statement with non-compound name 'Nette' has no effect :-(
 [2008-12-28 23:33 UTC] david at grudl dot com
I have read it. 

Please, change status to Open.
 [2008-12-28 23:47 UTC] felipe@php.net
"Note that for namespaced names (fully qualified namespace names containing namespace separator, such as Foo\Bar as opposed to global names that do not, such as FooBar), the leading backslash is unnecessary and not allowed, as import names must be fully qualified, and are not processed relative to the current namespace."

This explain it.
 [2008-12-29 01:41 UTC] david at grudl dot com
1) The warning says "The use statement with
non-compound name 'Foo' has no effect". This is not correct. I have posted example which show it HAS effect. Try it run in PHP.

2) "...the leading backslash is unnecessary and not allowed, as import names must be fully qualified, and are not
processed relative to the current namespace."

This is nonsense. If they are not processed relative, Foo is fully qualified - why developers MUST use leading backslash in some cases and MUST NOT is other cases - in all cases it is fully qualified. This should be fixed in documentation.

Please, change status to Open.
 [2009-01-01 02:54 UTC] cellog@php.net
assign to namespace maintainer
 [2009-01-14 13:58 UTC] dmitry@php.net
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Mar 19 06:01:30 2024 UTC