修复代码样式:当PHP中没有变量时,将双引号字符串更改为单引号

时间:2010-10-14 11:45:22

标签: php code-standards

我想知道是否有一个工具,它将解析PHP项目并修复错误的代码样式。

这是一个双引号字符串,没有变量应改为单引号。

$var1="change enclosing to single quote"."here too";
$var2="change enclosing in this string but keep $i"."change it here";

我想在整个项目中自动重写:

$var1='change enclosing to single quote'.'here too';
$var2='do not change enclosing in this string '.$i.'change it here';

1 个答案:

答案 0 :(得分:1)

  

PHP codesniffer将显示这些内容   你这样你就可以在你之前改变它们   将代码提交到存储库但是这样   方法是预防不固定   事后......

http://pear.php.net/package/PHP_CodeSniffer/redirected

这是开发时应遵循的方法。