承接 lin3s/php-cs-fixer-config 相关项目开发

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

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

lin3s/php-cs-fixer-config

Composer 安装命令:

composer require lin3s/php-cs-fixer-config

包简介

PHP linting tool using PHP CS Fixer for LIN3S projects

README 文档

README

PHP linting tool using PHP CS Fixer for LIN3S projects

Build Status

It's based on kreta/php-cs-fixer-config.

Installation

$ composer require --dev lin3s/php-cs-fixer-config

Usage

Configuration

Create a configuration file .php_cs in the root of your project:

<?php

/*
 * This file is part of the PhpCsFixerConfig project.
 *
 * Copyright (c) 2017-present LIN3S <info@lin3s.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

declare(strict_types=1);

use LIN3S\PhpCsFixerConfig\Lin3sConfig;

$config = new Lin3sConfig('LIN3S awesome project', '2017', 'project');
$config->getFinder()->in(__DIR__ . '/src');

$cacheDir = getenv('TRAVIS') ? getenv('HOME') . '/.php-cs-fixer' : __DIR__;

$config->setCacheFile($cacheDir . '/.php_cs.cache');

return $config;

In case your project uses PhpSpec BDD test framework, also create a .phpspec_cs file in the root of your project:

<?php

/*
 * This file is part of the PhpCsFixerConfig project.
 *
 * Copyright (c) 2017-present LIN3S <info@lin3s.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

declare(strict_types=1);

use LIN3S\PhpCsFixerConfig\Lin3sConfig;

$config = new Lin3sConfig('LIN3S awesome project', '2017', 'project', true);
$config->getFinder()
    ->in(__DIR__ . '/spec')
    ->name('*Spec.php');

$cacheDir = getenv('TRAVIS') ? getenv('HOME') . '/.php-cs-fixer' : __DIR__;

$config->setCacheFile($cacheDir . '/.php_cs.cache');

return $config;

Git

Add .php_cs.cache (this is the cache file created by php-cs-fixer) to .gitignore:

/vendor
/.php_cs.cache

Composer

Add the following scripts in the composer.json file:

(...)

"scripts": {
    (...)

    "cs": [
        "php-cs-fixer fix --config=.php_cs -v",
        "php-cs-fixer fix --config=.phpspec_cs -v"
    ]
},

Travis

Update your .travis.yml to cache the php_cs.cache file:

cache:
  directories:
    - $HOME/.php-cs-fixer

Then run php-cs-fixer in the script section:

script:
  - vendor/bin/php-cs-fixer fix --config=.php_cs --verbose --diff --dry-run
  - vendor/bin/php-cs-fixer fix --config=.phpspec_cs --verbose --diff --dry-run

Fixing issues

Manually

If you need to fix issues locally and if you previously added the composer script, just run:

$ composer run-script cs

otherwise you can run:

$ vendor/bin/php-cs-fixer fix -v
$ vendor/bin/php-cs-fixer fix -v --config=.phpspec_cs 

Licensing Options

License

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-06-07

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固