markdown 设置PHP CodeSniffer和WordPress标准

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了markdown 设置PHP CodeSniffer和WordPress标准相关的知识,希望对你有一定的参考价值。

# PHP CodeSniffer and WordPress Coding Standards

## Install phpcs
https://github.com/squizlabs/PHP_CodeSniffer

Make sure Composer in your path. If typing `phpcs -h` in the terminal is not a reconized command, add the following to your `.bashrc` or `.zshrc` (for Oh My ZSH).

`export PATH="$PATH:$HOME/.composer/vendor/bin"`

You should now be able to run the command `phpcs`. 

## Install WordPress Standards
https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards

Install following the *standalone* steps, placing the folder in your user.

Run `phpcs --config-set installed_paths Users/your-user-name/WordPress-Coding-Standards/`.

Now to run `phpcs -i` to make sure the coding standards were added. If you do not see any WordPress standards listed, make sure you add the complete path (from the system root) with the `phpcs --config-set installed_paths` command.  

## VS Code
Install the [phpcs extension](https://marketplace.visualstudio.com/items?itemName=ikappas.phpcs).

Add the following to your user `settings.json`.

`"phpcs.standard": "WordPress-Extra"`

If you are still getting an error add the path to the phpcs under the `"phpcs.executablePath"`. You can get this path by typeing `which phpcs`.

以上是关于markdown 设置PHP CodeSniffer和WordPress标准的主要内容,如果未能解决你的问题,请参考以下文章

markdown 设置PHP CodeSniffer和WordPress标准

markdown 通过Brew在OSX上设置PHP和Composer

markdown 使用PHP7-FPM和XDebug设置Nginx的快速指南

markdown [php:hash]在PHP上生成哈希。 #php #security

php markdown 接口文档生成工具

php 示例SVG和Markdown辅助函数#laravel #php