webifycms/dev-tools 问题修复 & 功能扩展

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

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

webifycms/dev-tools

最新稳定版本:v1.1.3

Composer 安装命令:

composer require webifycms/dev-tools

包简介

Set of development tools to analyze and auto fix code standards, formatting and other stuffs for WebifyCMS packages.

README 文档

README

Set of development tools to analyze and auto fix code standards, formatting and other stuffs for WebifyCMS packages.

The following libraries are included:

  • friendsofphp/php-cs-fixer
  • phpstan/phpstan
  • rectorphp/rector

Installation

Install via composer

composer require webifycms/dev-tools --dev

Configuration

  • PHP CS Fixer

You can add the rules and finder instance in the following way to your config file .php-cs-fixer.php:

use Webify\Tools\Fixer;
use PhpCsFixer\Finder;

// create a finder instance according to your needs
$finder = Finder::create()->in(__DIR__ . '/src');
// add the rules and it will override the defaults
$rules = [];

return (new Fixer($finder, $rules))->getConfig();
  • PHPStan

Add phpstan.neon in the root directory, and you can include src/phpstan.neon file like below if you wish but not necessary.

#...
includes:
  - vendor/webifycms/dev-tools/src/phpstan.neon
#...
  • Rector

Add rector.php in the root directory and the following, if you need to add more paths you can add them as well:

use Webify\Tools\Rector;

// Initialize
return (new Rector())
    ->initialize([
        __DIR__ . '/src',
        __DIR__ . '/test'
    ])
    ->withPhpSets(php81: true);

Usage

  • Analyze your code first with PHPStan static analyzer for errors and fix (manual fix):
vendor/bin/phpstan analyse [options] [<paths>...]
  • Run code sniffer and format your codes.

(Recommended) If you wish to fix manually, you can just output the rules that will apply like the following.

./vendor/bin/php-cs-fixer fix --verbose --diff --show-progress=dots --dry-run

If you wish to auto fix the files, and output the summary of changes you can run the following.

./vendor/bin/php-cs-fixer fix --verbose --show-progress=dots

Upgrade code with RectorPHP

# to output the changes only
./vendor/bin/rector process --dry-run

# to make the changes
./vendor/bin/rector process

NOTE: You can also set up this extension with your favorite IDE or editor, so you can get more advantages like format on save while developing.

TODO

  • Install phpstan/phpstan library.
  • Install Rector rectorphp/rector library.
  • Add alias commands for the library commands, like the following:
# ./vendor/bin/php-cs-fixer fix --verbose --diff --show-progress=dots --dry-run
composer code-sniff

# ./vendor/bin/php-cs-fixer fix --verbose --show-progress=dots
composer code-format

# ./vendor/bin/phpstan
composer code-analyse
  • Add support to pass arguments to the alias commands.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-10-31