开发者

Fixing code style: change double quote strings to single quote in PHP when there are no variables in them

I am wondering if there is a tool, that will parse a PHP project and fix a bad code style.

That is a double quoted string that has no variables should be changed to single quote.

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

I would l开发者_开发技巧ike to rewrite automatically in entire project to:

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


PHP codesniffer will show these for you so you can change them before you commit code to the repository but this method is preventative not fixing something afterwards...

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

This is a methodology you should follow when developing.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜