批判PHP代码/ PerlCritic for PHP? [英] Critiquing PHP-code / PerlCritic for PHP?

查看:68
本文介绍了批判PHP代码/ PerlCritic for PHP?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找适用于PHP的PerlCritic 。 PerlCritc是一个静态源代码分析器,可以对代码进行问答并警告所有内容,包括未使用的变量,不安全的数据处理方式到几乎所有内容。

I'm looking for an equivalent of PerlCritic for PHP. PerlCritc is a static source code analyzer that qritiques code and warns about everything from unused variables, to unsafe ways to handle data to almost anything.

PHP是否存在这种情况?

Is there such a thing for PHP that could (preferably) be run outside of an IDE, so that source code analysis could be automated?

推荐答案

不确定是否可以在IDE外部运行该代码,从而可以自动进行源代码分析?曾经听说过可以执行所有操作的PHP工具...但是,一些可能与您至少有一点帮助的与QA相关的工具将是:

Not sure I've ever heard about a PHP tool that would do all that... But a couple of existing QA-related tools, that might help you at least a bit, would be :

  • PHPMD - PHP Mess Detector -- might actually be the best choice for you, if you consider the set of rules it checks for.
  • PHP_CodeSniffer
  • PHP_Depend
  • Of course, phpDocumentor can help too : when generating the phpDoc, it can report errors, especially about missing doc-blocks (doesn't report errors in the code, but can still help improve its quality !)
  • And don't forget the Xdebug extension, that can generate code-coverage reports, which are especially useful when your code is unit-tested with PHPUnit.

这两个文件将分析您的代码,并且可以从命令行(即在IDE之外)

Those two will analyse your code, and can be run from the command-line (i.e. outside of an IDE).

这篇关于批判PHP代码/ PerlCritic for PHP?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆