定制 garrcomm/code-sniffs 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

garrcomm/code-sniffs

Composer 安装命令:

composer require garrcomm/code-sniffs

包简介

Additional PHP Codesniffer rules made by Garrcomm.

README 文档

README

This package contains some additional PHP Codesniffer rules that can be included in your project.

Usage

These sniffs can be added as a composer package;

$ composer require garrcomm/code-sniffs dev-master --dev

After installing the package, add the following line to to your phpcs.xml file:

<config name="installed_paths" value="vendor/garrcomm/code-sniffs"/>
<rule ref="Garrcomm"/>

Or run PHP Codesniffer with the following parameters:

$ ./vendor/bin/phpcs --standard=vendor/garrcomm/code-sniffs path/to/your/files

But why don't you just write clean code from the start?

Sniffs help clean up legacy code, it's not just restricting new code. I found a few issues in existing legacy code and wrote sniffs to detect (and repair) some common issues.

Code quality

These sniffs are also written in PHP. Those PHP files are scanned with PHPUnit and PHPStan to make sure they work properly. Also, PHP CodeSniffer itself scanned the code so it complies with the PSR-12 standards and are well-documented. Those scans are automated in Bitbucket Pipelines.

Available sniffs

Tip for Windows Developers

In the bin folder, a few batch files exist, to make development easier.

If you install Docker Desktop for Windows, you can use bin\composer.bat, bin\phpstan.bat, bin\phpunit.bat, bin\phpcs.bat and bin\phpcbf.bat as shortcuts for Composer, PHP Static Analyser, PHP Unit, CodeSniffer and Code Beautifier without the need of installing PHP and other dependencies on your machine.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: CC-BY-SA-4.0
  • 更新时间: 2022-11-29