定制 inspirecz/coding-standard-sniffs 二次开发

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

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

inspirecz/coding-standard-sniffs

最新稳定版本:v1.4.0

Composer 安装命令:

composer require inspirecz/coding-standard-sniffs

包简介

INSPIRE Coding Standard Sniffs

README 文档

README

Sniffs for INSPIRE Coding Standard.

List of sniffs

Inspire.ControlStructures.DisallowHashComments 🔧

Reports and fixes hash comments in the code.

$correct = false; # This is (invalid) hash comment
👍
$correct = true; // This is a valid comment

Inspire.ControlStructures.InlineCommentSpacing 🔧

Reports and fixes invalid spaces count before and after inline comment start

//wrong inline comment
//   wrong inline comment
$a = 1; //wrong inline comment (missing space after "//")
$b = 2;// also wrong inline comment (missing space before "//")
👍
// correct inline comment with exactly one space after "//"
$a = 1; // correct inline comment
$b = 2; // correct inline comment

Inspire.ControlStructures.ControlStructureSpacing 🔧

Reports and fixes for correct spaces after control structures (exactly one space is expected, no more, no less).

if($foo) {
     //...
}
👍
if ($foo) { 
     //...
}

Inspire.ControlStructures.ClosingParenthesisOpeningCurlyBracketSameLineOnMultilineIf 🔧

Reports when closing parenthesis is not on the same line as opening curly bracket of if with multiline condition.

if (
    $foo
    && $bar
)
{ //...
👍
if (
    $foo
    && $bar
) { //...

Inspire.Methods.ClosingParenthesisOpeningCurlyBracketSameLineOnMultilineMethods 🔧

Reports when closing parenthesis is not on the same line as opening curly bracket on functions and methods with multiline arguments.

❌
public function foo(
    int $foo,
    string $bar,
)
{ //...
👍
public function foo(
    int $foo,
    string $bar,
) { //...

Inspire.Methods.MultilineMethodArgumentsParenthesisPosition

Checks whether there is no comma immediately preceding closing parenthesis of function or method argument list.

❌
public function foo(
    int $foo,
    string $bar, ) { //...
👍
public function foo(
    int $foo,
    string $bar,
) { //...
❌
public function foo(User $user,) { //...
👍
public function foo(User $user) { //...

Inspire.Sniffs.ControlStructures.BlankLinesSniff 🔧

Forces single blank line before control structures (DO, FOR, FOREACH, IF, SWITCH, WHILE), unless they are the first statement after block opening. Contains fixer.

Inspire.Sniffs.Methods.BlankLinesBeforeReturnSniff 🔧

Forces single blank line before return statement, unless it is the first statement after block opening. Contains fixer.

Inspire.Sniffs.Methods.DisallowTracyDumpMethodsSniff

Disallows debug statements in the code.

Inspire.Sniffs.Classes.EmptyInterfaceSniff

Disallows interfaces with no methods.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-09-20