Static Analysis with HipHop for PHP
Note: This article was originally published at Planet PHP
on 27 January 2012.
In July 2010 I already blogged about the fact that HipHop for PHP, the source code transformer that turns PHP code into C++ code that can then be compiled with g++, can also be used for static code analysis to find problems in PHP source code.
Today I started to work on a convenience wrapper for HipHop's static analyzer:
azo ~ hphpa /usr/local/src/code-coverage/PHP hphpa 1.0.0 by Sebastian Bergmann. /usr/local/src/code-coverage/PHP/CodeCoverage/Filter.php 206 TooManyArgument: $this-addFileToWhitelist($file, FALSE)Of course the tool can also generate an XML logfile in a format that is suitable for continuous integration: azo ~ hphpa --checkstyle hphpa.xml --quiet /usr/local/src/code-coverage/PHP hphpa 1.0.0 by Sebastian Bergmann. azo ~ cat hphpa.xml addFileToWhitelist($file, FALSE)" source="TooManyArgument"/


