William Turrell
William Turrell

Reputation: 3328

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?

Upvotes: 0

Views: 182

Answers (3)

Uladzimir Pasvistselik
Uladzimir Pasvistselik

Reputation: 3921

Also you can take a look at this tool: https://github.com/fabpot/PHP-CS-Fixer

Upvotes: 0

lena
lena

Reputation: 93868

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

Upvotes: 1

LazyOne
LazyOne

Reputation: 165471

Use standard shortcut: same as for invoking intentions menu (Quick Fix menu) manually in Editor: Alt + Enter (for Windows/Linux, not sure what that would be on Mac)

Upvotes: 1

Related Questions