定制 trayto-com/php-coding-standards 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

trayto-com/php-coding-standards

Composer 安装命令:

composer require trayto-com/php-coding-standards

包简介

Common coding-standard utils, tools and rules used across our PHP projects in trayto.com

README 文档

README

Common coding-standard utils, tools and rules used across our PHP projects in trayto.com

symplify/easy-coding-standard (ECS) is used under the hood. Follow configuration instructions there. Phar version is used so there should be no conflicts with projects dependencies.

Parallel Lint is available as well.

Further reading:

Installation instructions

composer require --dev trayto-com/php-coding-standards

Usage

You can use ECS directly in CLI but we do recommend to customise default rules:

vendor/bin/ecs check src tests --config vendor/trayto-com/php-coding-standards/definitions/ecs-default.php

Run PHP Parallel Lint:

vendor/bin/parallel-lint --exclude temp --exclude vendor .

Hint: do run linter before any other Standards check or Tests to fail fast in case of typo in your code

Customise ECS rules and custom usage

Recommended is to create your own configuration for project and define cache folder for EasyCodingStandard as well.

Create php file in your project root, for example ecs.php:

<?php declare(strict_types=1);

use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;

return static function (ContainerConfigurator $configurator): void {
    // make sure you import correct file
	$configurator->import(__DIR__ . '/vendor/trayto-com/php-coding-standards/definitions/ecs-default.php');

	$services = $configurator->services();
	// ... customise your services

	$parameters = $configurator->parameters();
	// .. customise your parameters

	$parameters->set(
		Option::CACHE_DIRECTORY,
		__DIR__ . '/temp/ecs'
	);
};

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-09-29

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固