phpcs can not find php in Visual Studio Code

  linux, php, phpcs, visual-studio-code

I have a question about Visual Studio Code and phpcs extension. I’m working in Ubuntu and I run in to problem, that VSCode could not start phpcs. It throws error: "/usr/bin/env: ‘php’: No such file or directory". I tried to run "vendor/bin/phpcs –version" from VSCode terminal and got same error. In same time "php -v" did work just fine. Then I tried to run same code in linux terminal and both commands worked there. After searching for solution I found solution, where suggested changing first line of phpcs file from "/usr/bin/env php" to direct php file location. And now all works. But it looks like a dirty way of fixing this issue. So, my question, is there any better solution for this problem?

Source: Ask PHP