Run the following commands :
$ composer global require phpmd/phpmd$ composer global require squizlabs/php_codesniffer$ composer global require friendsofphp/php-cs-fixer$ nano ~/.bash_profileand putexport PATH=~/.composer/vendor/bin:$PATH(make sure path is correct)$ source ~/.bash_profile
Go to Intellij > Preferences > Languages & Frameworks > PHP and add path for Mess Detector and Code Sniffer (ex: ~/.composer/vendor/bin/phpmd)
Go to Intellij > Preferences > Editor > Inspections and enable PHP Mess Detection validation + PHP Code Sniffer validation