bernskioldmedia/bm-wp-devtools

我们用于WordPress项目的开发工具。

安装: 141

依赖: 2

建议者: 0

安全: 0

星星: 0

关注者: 3

分支: 0

开放问题: 0

语言:Shell

dev-main 2021-11-25 20:58 UTC

This package is auto-updated.

Last update: 2024-09-26 03:34:30 UTC


README

这是一套我们用于插件和主题中WordPress开发的开发工具。

工具包括

  • PHPStan和WordPress规则
  • PHPCS规则集
  • PHPCS Fixer

安装

要在您的项目中使用此工具,请将此包作为composer dev-dependency要求

composer require bernskioldmedia/bm-wp-devtools --dev

将以下脚本添加到您的composer.json文件中

{
  "scripts": {
	"lint": "php-cs-fixer fix -v",
	"test:cs": "phpcs-wp",
	"test:types": "phpstan analyse --ansi --memory-limit=-1",
	"test:lint": "php-cs-fixer fix -v --dry-run",
	"test": [
	  "@test:lint",
	  "@test:types"
	]
  }
}

配置PHP Storm

PHPCS检查

  1. 转到 项目设置 > PHP > 代码检查器 并设置您的phpcs可执行文件。您应该使用安装于bin目录中的。
  2. 转到 项目设置 > 检查 > PHP > PHP代码检查器验证 并设置自定义编码标准。
  3. 使用路径选择 ("...") 在 vendor/bernskioldmedia/bm-wp-devtools/phpcs/ruleset.xml 中找到规则集