Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

phpcs: Unable to locate phpcs. Invalid version string encountered! #150

Open
needrunning opened this issue Jul 12, 2019 · 5 comments · May be fixed by #188
Open

phpcs: Unable to locate phpcs. Invalid version string encountered! #150

needrunning opened this issue Jul 12, 2019 · 5 comments · May be fixed by #188

Comments

@needrunning
Copy link

mac system

install phpcs via composer global require squizlabs/php_codesniffer

open vscode

installed phpcs extention

config it

exepath
/Users/usernama/.composer/vendor/squizlabs/php_codesniffer/bin/phpcs

show that

phpcs: Unable to locate phpcs. Invalid version string encountered!

@JAW-Dev
Copy link

JAW-Dev commented Aug 18, 2019

Yes, I've also been having this issue since the last vscode update.

@XLearner
Copy link

I use windows system and have the same problem. Have you solved it?

@needrunning
Copy link
Author

I have solved it via install PHP CodeSniffe on my system
phpcs

https://www.jianshu.com/p/8c16b1f247ed
phpcs

@davisben
Copy link

davisben commented Jan 9, 2021

In my case, I'm getting this error because of a PHP deprecation notice that is output when phpcs --version is run. The regex expects the output of that command to start with PHP_CodeSniffer version, followed by the version number, but the deprecation notice is printed before that, causing the version to not be matched.

@davisben davisben linked a pull request Jan 9, 2021 that will close this issue
@mjavadhpour
Copy link

mjavadhpour commented Mar 9, 2021

I have the same problem. php dump a warning message before any executed command and then the

.\vendor\squizlabs\php_codesniffer\bin\phpcs --version

dump this message:

PHP Warning:  Version warning: Imagick was compiled against ImageMagick version 1799 but version 1802 is loaded. Imagick will run but may behave surprisingly in Unknown on line 0

Warning: Version warning: Imagick was compiled against ImageMagick version 1799 but version 1802 is loaded. Imagick will run but may behave surprisingly in Unknown on line 0
PHP_CodeSniffer version 3.5.8 (stable) by Squiz (http://www.squiz.net)

I try to change error_reporting inside the php.ini from E_ALL to E_ERROR. and then the result of

.\vendor\squizlabs\php_codesniffer\bin\phpcs --version

changed to

PHP_CodeSniffer version 3.5.8 (stable) by Squiz (http://www.squiz.net)

and my problem was resolved.

@davisben Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants