getExecutableCommand(), 'echo phpversion();'); return $stdout; } public function shouldExpectCommandErrors() { return true; } public function supportsReadDataFromStdin() { return false; } protected function parseLinterOutput($path, $err, $stdout, $stderr) { // Older versions of php had both on $stdout, newer ones split it // Combine $stdout and $stderr for consistency $stdout = $stderr."\n".$stdout; $matches = array(); $regex = '/^(?.+?) error:\s+(?.*?)\s+in\s+(?.*?)'. '\s+on line\s+(?\d*)$/m'; if (preg_match($regex, $stdout, $matches)) { $type = strtolower($matches['type']); $message = new ArcanistLintMessage(); $message->setPath($matches['file']); $message->setLine($matches['line']); $message->setCode('php.'.$type); $message->setDescription('This file contains a '.$type.' error: '. $matches['error'].' on line '.$matches['line']); $message->setSeverity(ArcanistLintSeverity::SEVERITY_ERROR); // php -l only returns the first error return array($message); } return array(); } }