Use PHP Code Sniffer to detect violations to coding standards in your PHP files.
To use PHP Code Sniffer in PHPStorm, open the Settings and go to PHP -> Code Sniffer
In the field ‘PHP Code Sniffer (phpcs) path:’ fill in the path where the binary resides. Most of the times this is ‘/usr/bin/phpcs’. If it’s not, you can find it by going to the commandline and type ‘which phpcs‘:
$ which phpcs /usr/bin/phpcs
Click on the button ‘validate‘ to have PHPStorm validate your phpcs binary. If everything is OK, you’ll see a green bar like in the image below.
To have your PHP file checked in PHPStorm, right-click on the file in the explorer-view and choose the option ‘Inspect Code…’.
In the window that follows, click on the button next to the selector of ‘Inspection profile’ with the selected option ‘Project Default’.
Be sure that the checkbox ‘PHP Code Sniffer Validation‘ is checked as it is in the image below.
Close that screen and click ‘Ok’ to have PHPStorm check your file with all the enabled options of the screen above.
On the bottom of the editor you’ll see the findings of the inspectation.