PHP Code Sniffer not working: Interface 'PHP_CodeSniffer_Sniff' not found Follow
Answered
In my PhpStorm Code Sniffer does not work.
The error says "Interface 'PHP_CodeSniffer_Sniff' not found in moodle/Sniffs/Commenting/InlineCommentSniff.php on line 27". (Source is here: https://github.com/moodlehq/moodle-local_codechecker/tree/master/moodle/Sniffs/Commenting)
I have macOS 10.12, PHP 7.1.5, and PHP_CodeSniffer version 3.0.0 (stable) by Squiz (http://www.squiz.net) setup with brew.
Thanks for any hint!
Please sign in to leave a comment.
Hello,
Does it work fine when running Code Sniffer from command line?
Good question, Vladimir.
No, it does not.
Something with running
or anything similar I forgot for CodeSniffer to work?
I would suggest to follow installation steps from https://github.com/squizlabs/PHP_CodeSniffer again, just to be sure.
I've just installed PHP_CodeSniffer and the moodle-local_codechecker, following the given instructions, and I'm having the same issue. PhpStorm outputs the following error:
phpcs: PHP Fatal error: Interface 'PHP_CodeSniffer_Sniff' not found in /vagrant/public/local/codechecker/moodle/Sniffs/Commenting/InlineCommentSniff.php on line 27
I'm running Moodle on a LEMP vagrant box with PHP 7.0.22 and PHP_CodeSniffer version 3.1.0 (stable).
Did you find any solution to this problem?
Hi,
Do you also have issues with running it via command line?
No I couldn't get the moodle-local_codechecker plugin to work with PHP_CodeSniffer via the CLI either.
I eventually got it all working by installing the php-codesniffer package via Ubuntu. I had previously been installing it via composer and that didn't seem to work when used in conjunction with the moodle-local_codechecker plugin.
Thanks for sharing that!
Note to myself, the steps to circumvent the error and getting phpcs to work
Luca - you saved me a lot of time here. Remind me to buy you a beer at Moodle Dach 2018!