承接 fattureincloud/php-code-standard 相关项目开发

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

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

fattureincloud/php-code-standard

Composer 安装命令:

composer require fattureincloud/php-code-standard

包简介

PHP CS Fixer coding standard, extended from @PhpCsFixer.

README 文档

README

PHP CS Fixer coding standard, extended from @PhpCsFixer.

Prerequisites

You need to install PHP CS Fixer installed locally in the project and husky + lint-staged configured in order to make all of this working properly.

Install PHP CS Fixer

composer require friendsofphp/php-cs-fixer --dev

Install husky + lint-staged

Create a package.json like this one:

{
  "description": "For automation purposes",
  "license": "MIT",
  "devDependencies": {
    "husky": "^4.2.5",
    "lint-staged": "^10.2.7"
  },
  "lint-staged": {},
  "husky": {
    "hooks": {
      "pre-commit": "lint-staged"
    }
  }
}

Run npm install.

Add these lines to composer.json:

"scripts": {
    ...
    "post-install-cmd": "npm_config_loglevel=silent npm install",
    "post-update-cmd": "npm_config_loglevel=silent npm install",
    ...
}

Finally, remember to add node_modules/ to .gitignore.

Installation and usage

composer require fattureincloud/php-code-standard --dev

Add lint-staged action

Put this line as lint-staged action in package.json in order to execute PHP CS Fixer on all the staged files at commit time.

"lint-staged": {
    ...
    "*.php": "php ./vendor/bin/php-cs-fixer fix --allow-risky=yes --config ./vendor/fattureincloud/php-code-standard/.php-cs-fixer.php"
    ...
},

Add composer script (optional)

Add the following line under composer.json scripts property.

"scripts": {
    ...
    "php-cs-fixer": "./vendor/bin/php-cs-fixer --allow-risky=yes --config=./vendor/fattureincloud/php-code-standard/.php-cs-fixer.php"
    ...
}

PHPStorm

Enable inspections

  • Search for "PHP CS Fixer" under Quality Tools
  • Add a local configuration with path $PROJECT_DIR$/vendor/friendsofphp/php-cs-fixer/php-cs-fixer
  • Search for "PHP CS Fixer validation" under Inspections
  • Flag "Allow ricky rules"
  • Select Custom ruleset
  • Click on the 3 dots and enter <your-project-directory>/vendor/fattureincloud/php-code-standard/.php-cs-fixer.php

Configure file watcher

Create a file watcher with the following values:

Name: php-cs-fixer
File type: PHP
Scope: Current File
Program: $ProjectFileDir$/vendor/friendsofphp/php-cs-fixer/php-cs-fixer
Arguments: fix --allow-risky=yes --config=$ProjectFileDir$/vendor/fattureincloud/php-code-standard/.php-cs-fixer.php $FileDir$/$FileName$
Output paths to refresh: $FileDir$/$FileName$

De-flag all the advanced options.

Configure external tool (optional)

Create an external tool with the following values:

Name: Run PHP CS Fixer
Description: Run PHP CS Fixer
Group: External Tools
Program: $ProjectFileDir$/vendor/friendsofphp/php-cs-fixer/php-cs-fixer
Arguments: fix --allow-risky=yes --config=$ProjectFileDir$/vendor/fattureincloud/php-code-standard/.php-cs-fixer.php --verbose $FilePath$
Working directory: $ProjectFileDir$

Flag Synchronize files after execution and Open console for tool output.

VSCode

TODO

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-06-03

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固