bmewburn / vscode-intelephense

PHP intellisense for Visual Studio Code
https://intelephense.com
Other
1.57k stars 93 forks source link

Namespace resolver use basepath #2814

Open soymgomez opened 4 months ago

soymgomez commented 4 months ago

Feature description or problem with existing feature We have some projects where many namespaces share a common base. Nowadays we add the complete use and then invoke only class.

This sometimes causes us a collision of namespaces.

Describe the solution you'd like It would be interesting to be able to define a common base and if it detects it, use it to import the classes.

For example, we have the following classes:

App\Services\Integrations\Provider\Provider1::class
App\Services\Integrations\Provider\Provider2::class

If we define the following use:

use App\Services\Integrations;

When they are imported it would have to do it in the following way

Integrations\Provider\Provider1
Integrations\Provider\Provider2

Additional context This would solve the problem that if there is another class with the same name in another namespace it would be necessary to use aliases and at the same time reduce the number of use lines.