1

I want to configure code sniffer in phpstorm so i can refactor my code according to Magento coding standards

1 Answer 1

2

Code Sniffer Configurations:

Open PHPStorm, Alt + Ctrl + S Select PHP > Quality Tools > PHP_Codesniffer > ... > Give the path of "Suizlabs/PHP_Codesniffer/bin/phpcs" Then validate it and apply/Ok

Select Editor > Inspections > PHP > Quality Tools > Check the PHP_CodeSniffer validation Then in OPTIONS on the right side check all the options Give path of "vendor/magento/magento-coding-standard/Magento2" to Installed standards path

After that select "magento2" from the coding standard dropdown and apply/Ok.

Steps to properly configure spacing or lint feature in PHPStorm:

ctrl + alt + s Editor --> Code Style --> PHP --> Set from --> PSR1/PSR2 Apply and OK Press CTRL + ALT + L or CTRL + ALT + SHIFT + L

2
  • 2
    well answered. Thanks @P.A
    – S.Shah
    Jul 26, 2022 at 10:48
  • This one magically solved my problem. Thank you so much! Oct 29 at 20:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.