Search code examples
phpstorm

PhpStorm keyboard shortcut for code inspection recommended resolution?


If you run a code inspection, you might get something like this in the results panel:

Problem synopsis:
Traditional syntax array literal detected (at line 193)

Problem resolution:
Convert Array Syntax To Short

i.e. it's telling you to change array() to []

The 'resolution' is clickable and it'll fix it for you. But is a keyboard shortcut, or a way of shading identical problems (often you get a bunch of them) and having them fixed for you all at once?


Solution

  • You can use f2/Shift+f2 to jump to next/previous error, then hit Alt+Enter, Enter to apply suggested fixes. Note that there is a Code | Code Cleanup... command that runs inspections against your code and applies quickfixes. But it only includes a small subset of available inspections that are considered 'safe', so that applying hotfixes automatically doesn't break anything