简体   繁体   English

使用 php-cs-fixer 忽略编码标准?

[英]ignoring coding standards with php-cs-fixer?

In php_codesniffer you can ignore coding standards for a block of code thusly:在 php_codesniffer 中,您可以忽略一段代码的编码标准:

// @codingStandardsIgnoreStart
$a = ($b[$c >> 5 ] & 0x0080) &
     ($b[$c      ] & 0x0100) & // here is a multi-line
                               // quote from some spec
     ($b[$c >> 20]         );
// @codingStandardsIgnoreEnd

I think that's waaaay more readable then, say, this:我认为这更具可读性,比如说:

$a = ($b[$c >> 5] & 0x0080) & ($b[$c] & 0x0100) & ($b[$c >> 20]);

Does php-cs-fixer let you ignore coding standards for blocks of code like php_codesniffer does? php-cs-fixer 是否让您像 php_codesniffer 那样忽略代码块的编码标准?

Right now, PHP CS Fixer allows you only to ignore given paths (you may configure it in config file).现在,PHP CS Fixer 只允许您忽略给定的路径(您可以在配置文件中配置它)。 It is not possible to ignore part of code inside file.不可能忽略文件中的部分代码。 If you want, do not hesitate to raise a PR with proposed feature implemented!如果您愿意,请毫不犹豫地提出 PR 并实施建议的功能!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM