axazara/php-cs 问题修复 & 功能扩展

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

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

axazara/php-cs

最新稳定版本:v0.3

Composer 安装命令:

composer require axazara/php-cs

包简介

Axa Zara PHP Code style configuration for `php-cs-fixer` based on PSR-12.

README 文档

README

This package provides php-cs-fixer configuration applied in Axa Zara PHP projects. This represents the standard code style applied within Axa Zara's PHP project.

Quickstart

Step 1 of 3

Install the package via Composer:

composer require --dev axazara/php-cs

Step 2 of 3

Once package installed, a file .php-cs-fixer.dist.php will be created at the root of your project with the following contents:

<?php

use AxaZara\CS\Finder;
use AxaZara\CS\Config;

// Routes for analysis with `php-cs-fixer`
$routes = ['./src', './tests'];

return Config::createWithFinder(Finder::createWithRoutes($routes));

Change the value of $routes depending on where your project's source code is.

Step 3 of 3

And that's it! You can now find code style violations with the following command:

./vendor/bin/php-cs-fixer fix --config=.php-cs-fixer.dist.php --dry-run

And then completely fix them all with:

./vendor/bin/php-cs-fixer fix --config=.php-cs-fixer.dist.php

Configuration

You must pass a set of routes to the Finder::createWithRoutes() call. For example, for Laravel projects, this would be:

Finder::createWithRoutes(['./app', './config', './database', './resources', './routes', './tests'])

Also, you can pass a custom set of rules to the Config::createWithFinder() call:

Config::createWithFinder($finder, [
    '@PHP81Migration'   => true,
    'array_indentation' => false
])

License

This is open-sourced software licensed under the MIT License.

Special thanks

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-08-19