Summary:
See <https://github.com/facebook/arcanist/issues/102>. PHPCS changed its output format sometime between 1.4.6 (stable) and 1.5.0RC3.
Add a "no errors" test and make the linter work on both versions.
Test Plan: Ran `arc unit` on PHPCS 1.5.0RC3.
Reviewers: btrahan
Reviewed By: btrahan
CC: aran
Differential Revision: https://secure.phabricator.com/D6926
}
protected function parseLinterOutput($path, $err, $stdout, $stderr) {
+ // NOTE: Some version of PHPCS after 1.4.6 stopped printing a valid, empty
+ // XML document to stdout in the case of no errors. If PHPCS exits with
+ // error 0, just ignore output.
+ if (!$err) {
+ return array();
+ }
+
$report_dom = new DOMDocument();
$ok = @$report_dom->loadXML($stdout);
if (!$ok) {
--- /dev/null
+<?php
+
+/**
+ * This tests for a PHPCS lint run against a file without any errors. PHPCS
+ * literally requires all of this with this exact spacing and formatting.
+ *
+ * PHP version 5
+ *
+ * @category Function
+ * @package None
+ * @author Abraham Lincoln <alincoln@logcab.in>
+ * @license Imaginary License http://www.example.com/LICENSE
+ * @version GIT: HEAD
+ * @link http://www.derp.com/
+ */
+
+/**
+ * A function.
+ *
+ * @return void
+ */
+function f()
+{
+
+}
+~~~~~~~~~~