1条回答 默认 最新
dongyou5098 2018-08-18 17:31关注This error message has nothing to do with running PHP code. According to the dialogue you've installed the phpcs extension (emphasis mine):
This linter plugin for Visual Studio Code provides an interface to phpcs. It will be used with files that have the “PHP” language mode.
… but didn't complete the installation instructions:
Before using this plugin, you must ensure that
phpcsis installed on your system. The preferred method is using composer for both system-wide and project-wide installations.The tool name is actually PHP_CodeSniffer (phpcs is the name of one of the commands it provides) and you can find more comprehensive instructions in its Github project.
In any case you would still not done yet since you still need to configure the rules you want PHP_CodeSniffer to enforce. E.g., to enforce PSR-2 you can create a file called
phpcs.xmlin your project root:<?xml version="1.0"?> <ruleset name="My project coding style"> <rule ref="PSR2"/> <file>.</file> </ruleset>解决 无用评论 打赏 举报
