This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
<? namespace some/package; interface Listener { /** * @param \legacy_package_Request */ function handle(\legacy_package_Request $request); } ?> ------ Now let's use "Fix uses in current namespace" (CTRL-SHIFT-I) with default suggestions. By default NetBeans suggests to import \legacy_package_Request This is the result: ------ <? namespace some/package; use legacy_package_Request; interface Listener { /** * @param legacy_package_Request */ function handle(legacy_package_Request $request); } ?> ------ In runtime we recieve a PHP Warning: PHP Warning: The use statement with non-compound name 'legacy_package_Request' has no effect in **** on line 4 NetBeans should either import it as "use \legacy_package_Request;" or not import it at all (and leave all occurences unmodified). Product Version = NetBeans IDE Dev (Build 201209110001) Operating System = Linux version 3.2.0-31-generic-pae running on i386 Java; VM; Vendor = 1.7.0_07 Runtime = OpenJDK Client VM 23.2-b09
Created attachment 124496 [details] IDE log
If I run that code, no warning is shown (so it probably depends on a log level, or maybe PHP version?). That leading namespace separator for fixed use statements is handled by the option - Tools->Option->Editor->Formatting->PHP->Uses->Start Use Statements with a Namespace Separator. So you can choose what to use. Maybe we can add some new option, something like "Don't Use Types from Default Namespace"...or something like that, which will not import these types, or something better and different, but it's definitely enhancement for next release. Thanks for catching that!
Our PHP version is 5.3.8 It is reproducible with error_reporting(E_ALL) If I check "Start Use Statements with a Namespace Separator", all uses start with it: <? use \some\package\Listener; use \legacy_package_Request; new legacy_package_Request(); ?> For some people this is the standard, for others it isn't. People who prefer use statements without the trailing backslash (like me), should only check "Prefer Fully Qualified Names over Use of Unqualified Names". It basically achieves my second suggestion from initial comment: (In reply to comment #0) > NetBeans should (...) not > import it at all (and leave all occurences unmodified). <? use some\package\Listener; new \legacy_package_Request(); ?> Thanks!