承接 fpcs/php-coding-standard 相关项目开发

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

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

fpcs/php-coding-standard

最新稳定版本:2.0.2

Composer 安装命令:

composer require fpcs/php-coding-standard

包简介

The FPCS PHP coding standard

README 文档

README

Packagist Version PHP from Packagist Packagist Downloads Packagist License

Installation

Install package:

composer require --dev fpcs/php-coding-standard

Implement standards:

./phpcs.xml:

<?xml version="1.0"?>
<ruleset>
    <rule ref="vendor/fpcs/php-coding-standard/phpcs" />
</ruleset>

./easy-coding-standard.yaml:

imports:
    - { resource: 'vendor/symplify/easy-coding-standard/config/set/psr2.yaml' }
    - { resource: 'vendor/symplify/easy-coding-standard/config/set/clean-code.yaml' }
    - { resource: 'vendor/fpcs/php-coding-standard/easy-coding-standard/*.yaml' }

Selecting specific standards:

There are base standards, and then more specific standards, which should be used IN ADDITION to the base standard.

Available standards:

  1. base (always use)
  2. laravel

./phpcs.xml:

<?xml version="1.0"?>
<ruleset>
    <rule ref="vendor/fpcs/php-coding-standard/phpcs/base.xml" />
    <rule ref="vendor/fpcs/php-coding-standard/phpcs/laravel.xml" />
</ruleset>

./easy-coding-standard.yaml:

imports:
    - { resource: 'vendor/symplify/easy-coding-standard/config/set/psr2.yaml' }
    - { resource: 'vendor/symplify/easy-coding-standard/config/set/clean-code.yaml' }
    - { resource: 'vendor/fpcs/php-coding-standard/easy-coding-standard/base.yaml' }
    - { resource: 'vendor/fpcs/php-coding-standard/easy-coding-standard/laravel.yaml' }

Automate:

package.json:

  "scripts": {
    ...
    "ecs": "./vendor/bin/ecs check ./ --fix",
    "phpcbf": "./vendor/bin/phpcbf ./",
    "phpcs": "./vendor/bin/phpcs -sp ./",
    "lint": "yarn ecs && yarn phpcbf",
    ...
  },

lint-stagerd.config.js:

module.exports = {
    '*.php': files => [
        `./vendor/bin/ecs check --fix "${files.join('" "')}"`,
        `./vendor/bin/phpcbf "${files.join('" "')}"`,
        `git add "${files.join('" "')}"`,
    ],
};

Run it:

yarn lint

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-09-24