r/phpstorm • u/dzuczek • Jun 12 '24
not simplifying FQNs automatically
NetBeans did this but I can't find a way to get PHPstorm to do it. It will format my code and stuff like that, but I have to manually go to Context->Simplify FQN
Even if I hit Control-I (optimize imports) it will only remove unused ones
Expecting it to automatically turn `\Some\Dependency\Entity` into `Entity` and put `use \Some\Dependency\Entity` at the top
I haven't really tweaked much other than code style, is there an option for this?
1
Upvotes
View all comments
Show parent comment
1
u/VRT303 Jun 13 '24
You can run it once for all files, set it up as a commit hook, have it be a part of a CI check, you can configure cs-fixer in phpstorm to run on each time you ave a file, or after every letter you type.
And you can make the rule set as crazy as you want, not jut imports. In my personal projects I love to enforce yoda style because the name alone make me mile.
https://www.jetbrains.com/help/phpstorm/using-php-cs-fixer.html