承接 endouble/symfony3-custom-coding-standard 相关项目开发

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

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

endouble/symfony3-custom-coding-standard

最新稳定版本:2.17

Composer 安装命令:

composer require endouble/symfony3-custom-coding-standard

包简介

Customized CodeSniffer ruleset for the Symfony3 projects

README 文档

README

This is a fork of https://github.com/djoos/Symfony2-coding-standard These are the Symfony2 standards, but tweaked to meet some needs we have in our CSB project, for example to comply with PSR-12 for PHP 7

Installation

Composer

This standard can be installed with the Composer dependency manager.

  1. Add the repository to your composer.json:
 "repositories": [
        {
            "type": "vcs",
            "url": "git@github.com:Endouble/Symfony3-custom-coding-standard"
        }
  1. Add the coding standard as a dependency of your project
 "require-dev": {
        "endouble/symfony3-custom-coding-standard": "^2.10"
    },
  1. Add the coding standard to the PHP_CodeSniffer install path

The path is relative to the php_codesniffer install path. This is important to make it work both in your vagrant, local machine and PHPStorm

    bin/phpcs --config-set installed_paths ../../endouble/symfony3-custom-coding-standard
  1. Check the installed coding standards for "Symfony2"

     bin/phpcs -i
    
  2. Done!

    bin/phpcs --standard=Symfony3Custom /path/to/code
    
  3. (optional) Set up PHPStorm

  • configure code sniffer under Languages & Frameworks -> PHP -> Code Sniffer
  • Go to Editor -> Inspections -> PHP Code sniffer, refresh the standards and select Symfony3Custom

Customizations

The following adjustments have been made to the original standard:

In Sniff/WhiteSpace/AssignmentSpacingSniff:

  • Added an exception for declare(strict_types=1); to comply with PSR-12

In Sniff/WhiteSpace/FunctionalClosingBraceSniff:

  • copied from Squiz and adapted to have no blank line at the end of a function

In Sniff/Commenting/FunctionCommentSniff:

  • check for 1 blank line above a docblock
  • don't check docblocks for test and setUp methods (PHPunit, would be blank)
  • do check protected and private methods for docblocks

In Sniff/NamingConventions/ValidClassNameSniff

  • remove the abstract class name rule

In ruleset.xml

  • Disabled the class comment rule
  • Changed the concatenation spacing rule, for readability, to require 1 space around concatenation dot, instead of no spaces as the Symfony standard requires.
  • Re-enabled the blank line check from superfluousWhitespace (disabled in PSR-2)

统计信息

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

GitHub 信息

  • Stars: 11
  • Watchers: 4
  • Forks: 103
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2016-06-17

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固