wpelevator/phpcs-parallel 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

wpelevator/phpcs-parallel

Composer 安装命令:

composer require wpelevator/phpcs-parallel

包简介

Run PHPCS and PHPCBF across monorepos with isolated per-project configs, optionally in parallel.

README 文档

README

Test

Run PHPCS once per project ruleset, optionally in parallel.

This is useful for monorepos where each package has its own phpcs.xml.dist. Instead of merging those rulesets into one PHPCS run, phpcs-parallel runs an isolated PHPCS process for each matched config.

Install

composer require --dev wpelevator/phpcs-parallel

Usage

Run PHPCS for every matched config:

vendor/bin/phpcs-parallel \
  --config-pattern='packages/*/phpcs.xml.dist' \
  --processes=4

Pass PHPCS options after --:

vendor/bin/phpcs-parallel \
  --config-pattern='packages/*/phpcs.xml.dist' \
  --processes=4 \
  -- -s --report=summary

Run PHPCBF the same way:

vendor/bin/phpcbf-parallel \
  --config-pattern='packages/*/phpcs.xml.dist' \
  --processes=4

You can repeat --config-pattern or provide comma-separated patterns:

vendor/bin/phpcs-parallel \
  --config-pattern='packages/*/phpcs.xml.dist' \
  --config-pattern='apps/*/phpcs.xml.dist'

vendor/bin/phpcs-parallel \
  --config-pattern='packages/*/phpcs.xml.dist,apps/*/phpcs.xml.dist'

Each matched config runs as:

phpcs --standard=/path/to/package/phpcs.xml.dist /path/to/package

Config resolution

When project directories are provided explicitly, each directory uses the first config found in that directory, falling back to the nearest parent config. Config names are checked in this order:

  1. .phpcs.xml
  2. phpcs.xml
  3. .phpcs.xml.dist
  4. phpcs.xml.dist

When no project directories are provided, the current working directory is recursively searched for matching config files. Passing both project directories and --config-pattern combines explicit projects with discovered projects and deduplicates them by project root.

Composer scripts

{
  "scripts": {
    "lint": "phpcs-parallel --config-pattern='packages/*/phpcs.xml.dist' --processes=4 -- -s",
    "format": "phpcbf-parallel --config-pattern='packages/*/phpcs.xml.dist' --processes=4"
  }
}

Development

Run the same checks used by CI:

composer lint
composer test

Run a specific test suite:

vendor/bin/phpunit --testsuite Unit
vendor/bin/phpunit --testsuite Integration

Notes

  • Dependency directories are skipped during discovery: .git, vendor, node_modules, bower_components.
  • The wrapper returns the highest child exit code for PHPCS/PHPCBF lint/fix results. Runtime/tool errors are promoted to at least exit code 3.
  • Child process output is streamed through Symfony Console and prefixed with the project label.
  • Use explicit project directories instead of patterns if needed: vendor/bin/phpcs-parallel packages/foo packages/bar.

License

This project is open-sourced under the MIT License. See LICENSE for details.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-07-01

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固