我的phpcodesniffer报告生成了类似以下示例的代码行:
146 | ERROR | Variable "tw_text" is not in valid camel caps format (Zend.NamingConventions.ValidVariableName.NotCamelCaps)
148 | ERROR | Variable "tw_text" is not in valid camel caps format (Zend.NamingConventions.ValidVariableName.NotCamelCaps)
154 | ERROR | Variable "tw_text" is not in valid camel caps format (Zend.NamingConventions.ValidVariableName.NotCamelCaps)这将报告同一变量的持续使用情况,例如:
$tw_text = '';
:
$tw_text = $_POST['text'];
:
$tw_text = '';我只需要第一份报告,因为第二份和第三份报告实际上依赖于第一份报告。
有什么方法可以做到这一点吗?
发布于 2014-02-14 06:36:49
您可以使用一个简单的脚本来过滤错误。
#!/usr/bin/env php
<?php
$seen = [];
while ($line = fgets(STDIN)) {
$err = explode('|', $line)[2];
if (in_array($err, $seen))
continue;
$seen[] = $err;
print($line);
}https://stackoverflow.com/questions/21748515
复制相似问题