承接 simgroep/coding-standards 相关项目开发

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

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

simgroep/coding-standards

最新稳定版本:2.1.0

Composer 安装命令:

composer require simgroep/coding-standards

包简介

Coding standard configuration for SIMGroep PHP projects using fabpot/php-cs-fixer

README 文档

README

Coding standard configuration for SIMGroep PHP projects using friendsofphp/php-cs-fixer

Installation

$ composer require simgroep/coding-standards

Configuration

To customize the default configuration in your project you can add a .php-cs-fixer.php to your project and include the default configuration like this:

<?php


$config = require 'vendor/simgroep/coding-standards/php-cs-fixer.dist.php';

$config->setFinder(
    \PhpCsFixer\Finder::create()
        ->in([
            getcwd() . '/src',
            getcwd() . '/test',
        ])
    )
;

return $config;

LEGACY NOTE the deprecated name for the configuration file was .php_cs, and for a legacy use may still require the vendor/simgroep/coding-standards/.php_cs.dist instead

Symfony example

When applying the coding standards to a standard Symfony project you can customize the configuration for a blacklisting approach like this:

<?php

$config = require 'vendor/simgroep/coding-standards/.php_cs.dist';

$config->setFinder(
    \PhpCsFixer\Finder::create()
        ->in(getcwd())
        ->exclude('app')
        ->exclude('bin')
        ->exclude('var/cache')
        ->exclude('vendor')
    )
;

return $config;

Usage

Only check for coding standard violations:

$ ./vendor/bin/php-cs-fixer fix --dry-run --diff --config=vendor/simgroep/coding-standard/.php_cs.dist --stop-on-violation --allow-risky=yes

Fix coding standard violations:

$ ./vendor/bin/php-cs-fixer fix --diff --config=vendor/simgroep/coding-standard/.php_cs.dist --stop-on-violation --allow-risky=yes

PhpStorm integration

Start by installing this library global:

$ composer global require simgroep/coding-standards

Open PhpStorm and navigate to "Settings" -> "Tools" -> "File Watchers" add one (+). Disable "Immediate file synchronization".

Program: /Users/<username>/.composer/vendor/bin/php-cs-fixer

Arguments: fix $FileDir$/$FileName$ --config=/Users/<username>/.composer/vendor/simgroep/coding-standards/.php_cs.dist

Working dir: $ProjectFileDir$

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2016-07-13