承接 meom/phpcs-composer 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

meom/phpcs-composer

Composer 安装命令:

composer require meom/phpcs-composer

包简介

README 文档

README

This is a standalone composer package for Custom WPCS and PHPCompatibilityWP rulesets.

Requirements

  • PHP 7+.
  • Composer for managing PHP dependencies.

Installation

Use Composer to install the package.

composer require --dev meom/phpcs-composer:dev-main

Usage

Lint your PHP files with the following command:

./vendor/bin/phpcs .

Or give path to lint theme folder, for example:

./vendor/bin/phpcs htdocs/wp-content/themes/theme-name

Note that by default warning are not displayed. You can change that with --severity flag like this:

./vendor/bin/phpcs --severity=1 htdocs/wp-content/themes/theme-name

Fixing issues using PHPCBF command

Some of the issue can be fixed using phpcbf command:

./vendor/bin/phpcbf .

Or give path to fix theme folder, for example:

./vendor/bin/phpcbf htdocs/wp-content/themes/theme-name

Note that by default warnings are not fixed. You can fix warnings also with --severity flag like this:

./vendor/bin/phpcbf --severity=1 htdocs/wp-content/themes/theme-name

More info about fixing PHPCS errors automatically.

IDE Integration

Some IDE integrations of PHPCS fail to register the MEOM-default ruleset. In order to rectify this, place .phpcs.xml.dist at your project root:

<?xml version="1.0"?>
<ruleset name="Project Rules">
    <rule ref="MEOM-default" />
</ruleset>

Note this is already added in Kala Stack.

VS Code

If you don't have PHP codesniffer installed globally, you might need to

  1. Create folder .vscode (in the root of the project).
  2. Add file settings.json in the folder.
  3. Add the following content in the file.
{
    "phpcs.executablePath": "./vendor/bin/phpcs"
}

P.S. Windows is looking for file ./vendor/bin/phpcs.bat. If that's not generated automatically in ./vendor/bin/ for some reason, test path ./vendor/squizlabs/php_codesniffer/bin/phpcs.

.bat files should be in that folder.

统计信息

  • 总下载量: 9.73k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 4
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 3
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-01-25

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固