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.

Bug 255268 - Guess of namespace for new interface does not work
Summary: Guess of namespace for new interface does not work
Status: VERIFIED FIXED
Alias: None
Product: php
Classification: Unclassified
Component: Project (show other bugs)
Version: 8.1
Hardware: All All
: P3 normal with 1 vote (vote)
Assignee: Tomas Mysik
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-09-14 11:53 UTC by pmaselkowski
Modified: 2016-06-09 08:57 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description pmaselkowski 2015-09-14 11:53:25 UTC
Scenario:
Add another interface to existing namespace. Other interfaces are in same folder.

Current behavior:

1. Click "New -> PHP Interface"
2. Window pop up.
3. "Namespace" combo box is empty

Expected behavior:

1. Click "New -> PHP Interface"
2. Window pop up.
3. "Namespace" combo box contains same namespace as other interfaces in folder


This works properly when creating classes, but not interfaces.

Tried in build 201509090002, however as far as I remember it is not working properly from a long time.
Comment 1 junichi11 2015-10-22 04:24:57 UTC
Probably, project area.

Thanks.
Comment 2 pmaselkowski 2015-10-22 08:14:29 UTC
One more important note about this issue:

This fails if in folder are only interfaces or traits (in this case it fails for classes too). If it contains classes, namespace is guessed properly.

Looks like interfaces and traits are not checked when searching for namespace.
Comment 3 gevik 2016-03-11 14:40:16 UTC
If would be very nice if the system could guess the namespace based on the 
folder where the class/interface was going to be created in the "New Class/Interface" dialog window. 

If this is not possible or difficult to implement then perhaps it is easier 
to "find/replace" the directory separator (/)(on *nix) with the namespace separator (\). This way we can just copy and paste the Folder to Namespace and have a quick way of auto-completing the empty namespace.
Comment 4 pmaselkowski 2016-03-14 07:59:45 UTC
Re: gevik@netbeans.org

It works when folder contains classes. So guessing namespace is implemented.

It fails if it contains only interfaces or traits. Like these are not scanned?
Comment 5 Tomas Mysik 2016-06-03 12:55:18 UTC
(In reply to pmaselkowski from comment #4)
> It fails if it contains only interfaces or traits. Like these are not
> scanned?

Exactly. Will try to fix it.

Thanks for reporting.
Comment 6 Tomas Mysik 2016-06-07 13:48:30 UTC
Should be fixed now I hope. Please verify, thanks.

http://hg.netbeans.org/web-main/rev/1dabe925c878
Comment 7 pmaselkowski 2016-06-09 07:12:38 UTC
(In reply to Tomas Mysik from comment #6)
> Should be fixed now I hope. Please verify, thanks.
> 
> http://hg.netbeans.org/web-main/rev/1dabe925c878

Now works fine, thanks! That bug was pretty annoying.
Comment 8 Tomas Mysik 2016-06-09 08:57:36 UTC
Thanks for verification.