cartalyst/php-cs-fixer-config 问题修复 & 功能扩展

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

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

cartalyst/php-cs-fixer-config

最新稳定版本:v2.0.0

Composer 安装命令:

composer require cartalyst/php-cs-fixer-config

包简介

PHP CS Fixer configuration for Cartalyst projects

README 文档

README

This repository provides a base configuration for friendsofphp/php-cs-fixer, which we use to verify and enforce a single coding standard for PHP code written on Cartalyst.

Installation

Run the following:

composer require --dev cartalyst/php-cs-fixer-config

Usage

Now that the package is installed, create a configuration file called .php_cs or .php_cs.php at the root of your project with the following contents:

<?php

// Create a new CS Fixer Finder instance
$finder = PhpCsFixer\Finder::create()->in(__DIR__);

return Cartalyst\PhpCsFixer\Config::create()
    ->setFinder($finder)
;

Ignoring files and/or directories

There will be certain situations where you might want to ignore certain files or directories to not be linted.

Luckily, this is quite easy to achieve and all you need to do is to perform some calls on the CS Fixer Finder instance :)

Here's a simple example where we ignore both files and directories:

<?php

// Directories to not scan
$excludeDirs = [
    'vendor/',
];

// Files to not scan
$excludeFiles = [
    'config/app.php',
];

// Create a new CS Fixer Finder instance
$finder = PhpCsFixer\Finder::create()
    ->in(__DIR__)
    ->exclude($excludeDirs)
    ->ignoreDotFiles(true)
    ->ignoreVCS(true)
    ->filter(function (\SplFileInfo $file) use ($excludeFiles) {
        return ! in_array($file->getRelativePathName(), $excludeFiles);
    })
;

return Cartalyst\PhpCsFixer\Config::create()->setFinder($finder);

Enforce coding standards for PHPUnit tests

If you would like to also enable coding standards on your tests, you can call the withPHPUnitRules() method on the Config class, like so:

<?php

// Create a new CS Fixer Finder instance
$finder = PhpCsFixer\Finder::create()->in(__DIR__);

return Cartalyst\PHPCsFixer\Config::create()
    ->setFinder($finder)
    ->withPHPUnitRules()
;

Contributing

Thank you for your interest in PHP CS Fixer Config. Here are some of the many ways to contribute.

Security

If you discover any security related issues, please email help@cartalyst.com instead of using the issue tracker.

License

PHP CS Fixer Config is licenced under the BSD 3-Clause. Please see the license file for more information.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: BSD-3-Clause
  • 更新时间: 2019-07-26

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固