PHP CS Fixer - force to use project CLI version in inspections instead of system one

I installed PHP CS Fixer as a composer dependency using this article:

In IDE configuration I set that fixer should use local interpreter.

CLI interpreter is set as follows (7.2)

Also a composer is set to use 7.2 version

When I try to validate fixer I get an error

It's because my default `php` path is set to 7.0.33 version. However I want fixer to use phpStorm CLI interpreter as that project uses higher version of php.

I have also added to my path another php version called `php72` so if I want to use that version by any script, I have to type `php72 command` instead of `php`.

How to configure fixer in phpStorm to use CLI version defined by IDE or change a path to use my custom `php72` command?


Edit: I refer to running fixer as phpStorm inspections not manually.

1 comment

Ok. I found a workaround for my problem. I need to edit php-cs-fixer.bat and change line from

php "%BIN_TARGET%" %*


php72 "%BIN_TARGET%" %*

But I can do it only because I've got configured locally 2 php versions. For me it still should be an option to use other local interpreter than default one or it should use interpreter defined as CLI for project.


Please sign in to leave a comment.