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: https://www.jetbrains.com/help/phpstorm/using-php-cs-fixer.html#installing-php-cs-fixer-composer

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
Comment actions Permalink

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

php "%BIN_TARGET%" %*

to

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.

0

Please sign in to leave a comment.