Adding USE statement automatically
I know there is a way to add use statement when cursor is positioned over unrecognized class name and I hit Alt+Enter. However if I already have inline FQCN, for example:
class OtherChoiceField extends \Symfony\Component\Form\AbstractType{
full path is added automatically from drop-down import list. Is there a way to optimize this code and create new use statement with \Symfony\Component\Form\AbstractType? It is kinda annoying to have FQCN all over the code :-/
Thanks!
请先登录再写评论。
Hi Jovan,
Settings | Editor | Auto Import --> PHP | Automatically add 'use' statements
The above will do it automatically
Thanks you so much. :) My work is much simplier now!
I wasn't aware that this checkbox was added. I assume this came with version 5, since it wasn't there in 4.0.3 :)
Oh this feature does not work within PHPDoc. Instead, it leaves only class name which is, without proper use statement, undefined...
Hi Jovan,
Cannot help here -- I'm not really using namespaces myself and do not know how it actually works in PhpStorm.
I suggest checking the Issue Tracker for existing tickets and if none found feel free to submit new one.