2
votes

When I start typing a class name, and select a class from the dropdown, PhpStorm uses the short class name and automatically adds an import at the top of the file, which is very handy:

However, when I do the same for a root class, PhpStorm uses the FQCN, prepending \ to the class name, and adding no import statement at the top of the file:

Is there a way to configure PhpStorm to always use the short class name for root classes too?

1

1 Answers

2
votes

Sure, just use appropriate option for Class drop-down box under PHP | Treat symbols from the global space section: make sure it's "prefer import" instead of "prefer FQN".

That option is located at Settings/Preferences | Editor | General | Auto Import

enter image description here