How to configure phpStorm to automatically check the code with PHP_CodeSniffer

(*-*)浩
Release: 2020-01-04 14:30:55
Original
4500 people have browsed it

How to configure phpStorm to automatically check the code with PHP_CodeSniffer

# Environment ubuntu18.4 phpstorm pHP7.2

# The most correct installation method (Recommended Learning:phpstorm

sudo apt-get install php-codesniffer
Copy after login

composer Install PHP_CodeSniffer

composer global require "squizlabs/php_codesniffer=*" //这个方法装好后各种问题
Copy after login

Configure phpstorm

Find the phpcs file And remember

jiang@jiang:/usr/local$ cd /home/jiang/.config/composer/vendor/bin/jiang@jiang:~/.config/composer/vendor/bin$ ls
phpcbf  phpcs
Copy after login

Add the execution path to the environment variable vim ~/.bashrc

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:
Copy after login

Select File->Setting->Languages & Frameworks->PHP->Quality Tools-> Code Sniffer and configure it as follows

##Select File->Setting->Editor->Inspections- >Quality Tools->Check PHP Code Sniffer Validation and select PSR2How to configure phpStorm to automatically check the code with PHP_CodeSniffer

on the right and click VerifyHow to configure phpStorm to automatically check the code with PHP_CodeSniffer

##

The above is the detailed content of How to configure phpStorm to automatically check the code with PHP_CodeSniffer. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!