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 270500 - Suggest namespaces from parent folders, psr-4 psr-0 compliant
Summary: Suggest namespaces from parent folders, psr-4 psr-0 compliant
Status: NEW
Alias: None
Product: php
Classification: Unclassified
Component: Project (show other bugs)
Version: Dev
Hardware: PC Linux
: P3 normal with 2 votes (vote)
Assignee: issues@php
Depends on:
Reported: 2017-04-27 07:39 UTC by pmaselkowski
Modified: 2017-04-27 07:45 UTC (History)
1 user (show)

See Also:
Exception Reporter:

Example minimal project with above behavior (1.81 KB, application/zip)
2017-04-27 07:45 UTC, pmaselkowski

Note You need to log in before you can comment on or make changes to this bug.
Description pmaselkowski 2017-04-27 07:39:55 UTC
1. I have already some namespaced classes in project root, let namespace be Acme
2. I create folder, let's name it Helpers
3. I create right click on this new folder, and choose "New" > "PHP Class", as I wan't to create class Acme\Helpers\StoreLoader, according to PSR-4 namespace rules.
4. Namespace input is empty, which is correct, as there are no classes yet
5. I click arrow of "namespace" input, to check if there are other namespaces

Current behavior:
6. The list is empty

Proposed behavior:
6. Fill list with namespaces from parent folders
6.a Have on top of the list, or directly in input: "Parent\Namespace" + "\CurrentFolderName"

Will be easier and less error prone to just add last namespace part "Helpers", or choose guessed one.
Folder to namespace mapping is compatible with PHP's psr-4 and psr-0 namespace/autoloader standard.
Comment 1 pmaselkowski 2017-04-27 07:45:33 UTC
Created attachment 164197 [details]
Example minimal project with above behavior