interaction-design-foundation/coding-standard 问题修复 & 功能扩展

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

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

interaction-design-foundation/coding-standard

最新稳定版本:0.6.3

Composer 安装命令:

composer require interaction-design-foundation/coding-standard

包简介

IxDF Standard for PHP_CodeSniffer complements Consistence Coding Standard by providing sniffs with additional checks.

README 文档

README

Tests PHP Psalm PHP Psalm Level PHP Psalm Type Coverage

IxDF Coding Standard for Laravel

An opinionated ruleset focused on strict types. Suitable for both applications and packages.

Installation

  1. Install the package via composer by running:
composer require --dev interaction-design-foundation/coding-standard
  1. Add composer scripts into your composer.json:
"scripts": {
  "cs:check": "phpcs -p -s --colors --report-full --report-summary",
  "cs:fix": "phpcbf -p --colors"
}
  1. Create file phpcs.xml on the base path of your repository with content
<?xml version="1.0"?>
<ruleset name="My Coding Standard">
    <!-- Include all rules from the IxDF Coding Standard -->
    <rule ref="IxDFCodingStandard"/>

    <!-- Paths to check -->
    <file>app</file>
    <file>config</file>
    <file>database</file>
    <file>lang</file>
    <file>routes</file>
    <file>tests</file>
</ruleset>

Usage

  • To run checks only:
composer cs:check
  • To automatically fix many CS issues:
composer cs:fix

Ignoring parts of a File

Disable parts of a file:

$xmlPackage = new XMLPackage;
// phpcs:disable
$xmlPackage['error_code'] = get_default_error_code_value();
$xmlPackage->send();
// phpcs:enable

Disable a specific rule:

// phpcs:disable Generic.Commenting.Todo.Found
$xmlPackage = new XMLPackage;
$xmlPackage['error_code'] = get_default_error_code_value();
// TODO: Add an error message here.
$xmlPackage->send();
// phpcs:enable

Ignore a specific violation:

$xmlPackage = new XMLPackage;
$xmlPackage['error_code'] = get_default_error_code_value();
// phpcs:ignore Generic.Commenting.Todo.Found
// TODO: Add an error message here.
$xmlPackage->send();

Development

Versioning

New rules or Sniffs may not be introduced in minor or bugfix releases and should always be based on the develop branch and queued for the next major release, unless considered a bugfix for existing rules.

Reference

Rules can be added, excluded or tweaked locally, depending on your preferences. More information on how to do this can be found here:

统计信息

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

GitHub 信息

  • Stars: 6
  • Watchers: 8
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-04-14