PHP CS Fixer Support
PhpStorm already supports the popular code quality checking tools, PHPCS and PHPMD, which help you follow industry coding style standards (such as PSR-2), framework-specific standards, or your own team standards.
Checking for standards compliance is great, but fixing issues by hand can be tedious, especially on large projects. Well, there’s a tool for that, – PHP CS Fixer, – not only does it detect issues, but it will also fix them for you. PhpStorm 2018.3 brings in streamlined support for PHP CS Fixer!
To set up PHP CS Fixer in PhpStorm, all you need to do is modify your composer.json, just as you would do for other code quality tools:
- Add the
- Optionally, provide the custom ruleset in the
Then, run Install: PhpStorm will install the necessary packages, detect the path to PHP CS Fixer, and automatically set it up in Settings/Preferences. What’s more, your custom ruleset will also be detected, and the corresponding inspection will be enabled automatically, which can be found under Settings/Preferences | Editor | Inspections | PHP | Quality Tools, just like it would be for PHPCS and PHPMD:
That’s it, you are now good to go; you can now check your files and fix issues on the fly! Note that currently, due to PHP CS Fixer limitations, your only option is to apply the fix for the whole file, rather than fixing individual issues.
PHP CS Fixer in PhpStorm supports remote interpreters, too, so you can use one of the many Docker images available online with PHP CS Fixer. Some additional setup may be required in this case though, so refer to PhpStorm help should you need assistance.
Your JetBrains PhpStorm Team
The Drive to Develop
Subscribe to Blog updates
Thanks, we've got you!
Qodana Clone Finder: Early Access Program
In December 2020, we announced the EAP for Qodana, which is rapidly evolving into a comprehensive platform that allows companies to perform multi-level evaluations of the quality of code they own, contract, or purchase. Qodana helps you detect bugs without relying on an IDE, either on a local machi…
PhpStorm 2020.2 EAP #3
The Early Access Program for PhpStorm 2020.2 is in full swing and today we’ve got the third build of the 2020.2 EAP for you. In this blog post, you can read about improvements for Git installed in WSL2 and Search Everywhere. Download PhpStorm 2020.2 EAP (more…)…
PhpStorm 2019.3.3 Preview
We’ve just rolled out a preview for the third minor update for PhpStorm 2019.3. Please give the PhpStorm 2019.3.3 Preview build 193.6494.5 a try and share your feedback with us. (more…)…
How to Upgrade to PHP 7.4 with PhpStorm
Check out our fresh video with a few nice tips and tricks on how to update your codebase to PHP 7.4. It combines materials from the PhpStorm 2019.2 and PhpStorm 2019.3 releases, with a few cool bonuses to boot. Nikita drew our attention to the fact that setters are slower than assigning prop…