環境ubuntu18.4 phpstorm php7.2
composer global require "squizlabs/php_codesniffer=*" //这个方法装好后各种问题
找到phpcs檔案並記住
jiang@jiang:/usr/local$ cd /home/jiang/.config/composer/vendor/bin/jiang@jiang:~/.config/composer/vendor/bin$ ls phpcbf phpcs
export PHPCODESNIFFER=/home/jiang/.composer/vendor; export PATH=$JAVA_HOME/usr/local/eclipse:$ECLIPSE_HOME:$MAVEN_HOME/bin:$TOMCAT_HOME/bin:$TOMCAT_HOME/bin:$PHPCODESNIFFER/bin:$PATH:
##選擇File->Setting->Editor->Inspections- >Quality Tools->勾選PHP Code Sniffer Validation 選擇右側的PSR2
##點選驗證
以上是phpStorm怎麼設定PHP_CodeSniffer自動檢查程式碼的詳細內容。更多資訊請關注PHP中文網其他相關文章!