Home » Php » php – Uses generation in Netbeans

php – Uses generation in Netbeans

Posted by: admin July 12, 2020 Leave a comment


I wonder is there any way to make Netbeans work like an Eclipse the way you choose class name from autocompletion list and if use statement for that class does not exist then Netbeans will generate use and will use class name without full namespace?

Let me demonstrate what i mean. We have base image with autocomplete.

Base image

Current behaviour of Netbeans on when we hit Enter

Current behaviour

Desired behaviour of Netbeans

Desired behaviour

How to&Answers:

Doing a short research using Google I have found out, that it could be the CTRL + SHIFT + I key combination to invoke operation similar to Eclipse’s SHIFT + O within Java (to repair imports, if I remember it right).

Check the link where the operation is described.

It should be fine to write down in Your example:

$object = new ClassLoader;

And then hit CTRL + SHIFT + I to import the ClassLoader‘s namespace as an use statement…