Add phpCodeSniffer to PhpStorm:
-
In the Settings/Preferences dialog (Ctrl+Alt+S),
Languages & Frameworks | PHP | Quality Tools.
-
On the Quality Tools page that opens, expand the Code Sniffer area. From the Configuration list, choose the PHP Code Sniffer script that we just installed in our utilities directory.
You need to select > \phphcs\bin\phpcs.bat
WordPressCodingStandards: select code sniffer validation in: In the Settings/Preferences dialog (Ctrl+Alt+S) , navigate to:
Editor | inspections | PHP code sniffer validation | Coding Standards | Select required Wordpress Coding Standard
Inspect the Code:
to inspect code, navigate to:
Topbar | Code | inspect code
-
or use short key:
- Windows:
Ctrl + Alt + Shift + i
- Mac:
Cmd + Alt + Shift + i
- Windows:
-
or you may map custom keys for it.
Configuring WordPress code style:
In the Settings/Preferences dialog (Ctrl+Alt+S), navigate to Editor | Code Style | PHP.
On the Code Style. PHP page that opens, click the Set from... link.
On the context menu, choose Predefined Style, then choose WordPress.
Cna you create gif for this → On the context menu, choose Predefined Style, then choose WordPress.