Manuel Pichler has written a nice article about how to use PHP_CodeSniffer in the continuous build system CruiseControl. He uses PHP_CodeSniffer's XML output format and transforms it into a format that the Checkstyle Ant task can use. To quote:
This PEAR package provides a variety of pre defined coding standards like PEAR, ZEND etc., a small cli script phpcs to run PHP_CodeSniffer against your code and as best it provides an XML output generator. This output is not compatible with checkstyle but it is simple to transform into the Checkstyle format that is supported by CruiseControl. You can use the following stylesheet to transform the PHP_CodeSniffer output for your CruiseControl installation.
Manuel provides the complete XSLT and commands for transforming the XML, as well as the Ant build file. I gave the transformation a go myself, which turned this:
<?xml version="1.0" encoding="UTF-8"?>Into this:
<phpcs>
<file name="temp.php" errors="5" warnings="0">
<error line="2">Missing comment</error>
<error line="13">Missing tag</error>
<error line="13">Missing tag</error>
<error line="13">Missing tag</error>
<error line="13">Missing tag</error>
</file>
</phpcs>
<?xml version="1.0" encoding="UTF-8"?>(error messages shortened to fit)
<checkstyle>
<file name="temp.php">
<error line="2" severity="error" message="Missing comment"/>
<error line="13" severity="error" message="Missing tag"/>
<error line="13" severity="error" message="Missing tag"/>
<error line="13" severity="error" message="Missing tag"/>
<error line="13" severity="error" message="Missing tag"/>
</file>
</checkstyle>
Creating a new report format for PHP_CodeSniffer to match Checkstyle would be easy, but I haven't managed to track down any good examples of Checkstyle's XML output yet. I've put that on my todo list.